针对查询产生的临时文件,应该优化SQL语句,避免频繁使用order by、group by操作,可以适当的将tmp_table_size和max_heap_table_size值调大,但是为了减少磁盘使用而调高tmp_table_size和max_heap_table_size并不明智,因为内存资源远比磁盘资源宝贵。您可以通过explain加SQL语句查看是否使用
多数原因是程序太垃圾,SQL语句没有优化所致。或者说是数据库索引与数据库语句不匹配。
Learn about the status variables and server options related to internal temporary tables and how to avoid creating internal temporary tables on disk. The status variables include: Created_tmp_disk_tables Created_tmp_tables The server options include: max_heap_table_size tmp_table_size Solution Sign...
Answer 1) yes mysql do use temp table for index rebuild but you haven't mentioned which table storge engine you have use for this table. ofcourse if the temp table is bigger than tmp_table_size, Temp tables are always created on disk if they use columns types that the in-memory temp...