Increase tmp_table_size/max_heap_table_size does not improve Tmp_Tables_ToDisk percentage
0
votes
0
answers
33
views
I am using MariaDB 10.6.19.
Below is my.cnf settings:
[mysqld]
performance-schema=0
max_connections=1500
max_user_connections = 1200
query_cache_size = 64M
skip-external-locking
key_buffer_size = 64M
max_allowed_packet=268435456
table_open_cache = 256
sort_buffer_size = 1M
net_buffer_length = 16K
read_buffer_size = 1M
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 32M
innodb_file_per_table
tmp_table_size=64M
max_heap_table_size=64M
thread_cache_size = 8
query_cache_type = on
innodb_use_native_aio = 1
default_storage_engine = MyISAM
open_files_limit=40000
unix_socket=OFF
I use the following query:
SELECT ROUND( (SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME='Created_tmp_disk_tables') / (SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME='Created_tmp_tables') * 100, 2 ) AS 'Tmp_Tables_ToDisk%
and it turns 29.97%. Based on Claude.AI suggests, I increase the following settings:
tmp_table_size=64M -> 1280M (about 1% of total memory 128GB)
max_heap_table_size=64M -> 1280M
However, after restarting MySQL and wait for 23 hours, I recalculate Tmp_Tables_ToDisk% and get 32.56%, which is not improved.
Claude.AI suggests to increase the tmp_table_size/max_heap_table_size more, so I change:
tmp_table_size=1280M -> 2560M
max_heap_table_size=1280M -> 2560M
However, after 7 hours, Tmp_Tables_ToDisk% is 33.78. Still not improved.
Why? Should I increase tmp_table_size/max_heap_table_size further more?
**Update:**
I try to enable slow query log and restart mysql, as below:
long_query_time=2
slow_query_log=1
After 6 hours, Created_tmp_tables is 58313 and Created_tmp_disk_tables is 25066, but there are only 16 queries in the slow log. Which means most of the queries that create temp tables are fast(< 2 seconds).
Asked by alancc
(163 rep)
Jul 12, 2025, 10:27 AM
Last activity: Jul 15, 2025, 04:47 AM
Last activity: Jul 15, 2025, 04:47 AM