I use MySQL version 5.6.25-0ubuntu0.15.04.1 on 64-bit Ubuntu 15.04. I have 2GB RAM and the disk is SSD (so, in my mind, writing to disk isn't that costly). I currently have databases for just two small Wordpress blogs. I wasn't trying to get too deep into optimizing this but I encountered what I consider to be strange behavior.
When I run MySQLTuner 1.5.0, I get the following output:
[OK] Currently running supported MySQL version 5.6.25-0ubuntu0.15.04.1
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics-------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in InnoDB tables: 7M (Tables: 30)
[!!] Total fragmented tables: 3
-------- Performance Metrics -----------------------------------------
[--] Up for: 10d 13h 0m 49s (86K q [0.095 qps], 3K conn, TX: 218M, RX: 26M)
[--] Reads / Writes: 73% / 27%
[--] Binary logging is disabled
[--] Total buffers: 296.0M global + 1.1M per thread (75 max threads)
[OK] Maximum reached memory usage: 302.8M (15.20% of installed RAM)
[OK] Maximum possible memory usage: 380.4M (19.10% of installed RAM)
[OK] Slow queries: 0% (0/86K)
[OK] Highest usage of available connections: 8% (6/75)
[OK] Aborted connections: 0.34% (11/3243)
[!!] Key buffer used: 18.2% (1M used / 8M cache)
[OK] Key buffer size / total MyISAM indexes: 8.0M/109.0K
[OK] Read Key buffer hit rate: 96.7% (30 cached / 1 reads)
[OK] Query cache efficiency: 45.3% (27K cached / 60K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts)
[!!] Temporary tables created on disk: 81% (2K on disk / 2K total)
[OK] Thread cache hit rate: 99% (6 created / 3K connections)
[OK] Table cache hit rate: 76% (115 open / 150 opened)
[OK] Open file limit used: 0% (48/16K)
[OK] Table locks acquired immediately: 100% (41K immediate / 41K locks)
-------- InnoDB Metrics ----------------------------------------------
[--] InnoDB is enabled.
[OK] InnoDB buffer pool / data size: 128.0M/7.4M
[OK] InnoDB buffer pool instances: 1
[!!] InnoDB Used buffer: 15.19% (1244 used/ 8191 total)
[OK] InnoDB Read buffer efficiency: 99.93% (1295836 hits/ 1296742 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[OK] InnoDB log waits: 0.00% (0 waits / 12926 writes)
-------- Recommendations ---------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
tmp_table_size (> 128M)
max_heap_table_size (> 128M)
My problem is the tmp_table_size (and max_heap_table_size). Every week I've been increasing it and MySQLTuner keeps suggesting larger. (As you can see, it now proposes >128M.) I can see from the above output that it's writing tables to disk, which I assume is the reason for the suggestion. However, in my understanding, this only relates to the MyISAM engine, while all of my Wordpress tables are using the InnoDB engine. I assume there are some internal MySQL tables that may be using MyISAM, but I still don't know why MySQLTuner thinks I need such a massive table size just for that minimal stuff.
So, the question: Why does MySQLTuner think I need such large temp tables, when I use only InnoDB?