Finding what Created_tmp_disk_tables with log_slow_filter

September 22, 2008
Author
Ewen Fortune
Share this Post:

Whilst working with a client recently I noticed a large number of temporary tables being created on disk.


Looking at a 60 second sample showed there was a steady flow of queries creating disk based tables.

Luckily this client was running the Percona patched version of MySQL.

The microslow patch adds a very useful feature, the ability to log queries by execution plan.

Log only the queries that followed certain execution plan. Multiple flags allowed in a comma-separated string. [qc_miss, full_scan, full_join, tmp_table, tmp_table_on_disk, filesort, filesort_on_disk]

So now all I had to do was set the filter to “tmp_table_on_disk,filesort_on_disk” and I would get only those which use on-disk temporary storage for intermediate results.

Wait a couple of minutes and then set the filter to an empty string to stop collection.

Then it was just a question of examining the slow query log and fixing the queries.
More information about the patches is available here https://www.percona.com/percona-lab.html

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved