我最近开始注意到我的 MySQL 的大量 tmp 表都是在磁盘上而不是内存中创建的。
TEMP TABLES
Current max_heap_table_size = 128 M
Current tmp_table_size = 128 M
Of 73993 temp tables, 46% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.
我该如何优化它以便它使用内存而不是磁盘,因为这样会更快。
答案1
您打印的文本告诉您需要做什么:
Perhaps you should increase your tmp_table_size and/or max_heap_table_size to reduce the number of disk-based temporary tables
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_tmp_table_size http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_heap_table_size