excluding some mysql queries from the slow query log

i keep close eye on the mysql-slow.log log of queries that take more than 1s to execute. but at the same time i know about few house-keeping queries that are executed few times per day that by design take longer to execute [eg table checksums]. i don’t want those queries to ‘pollute’ the slow query log.

one approach was to ‘chop’ the heavy/planned queries into smaller ones; another – to temporarily disable slow query logging or change the minimum duration threshold needed for queries to enter mysql-slow.log. 2nd one sounded more reasonable; solution:

SET @@session.long_query_time = 3;

.. actual query;

SET @@session.long_query_time=@@global.long_query_time;

[inspired by this post]

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)