Occasionally there is a need to see what queries reach MySQL. The
database provides several ways to share that information with
you. One is called general log activated with
--log (or --general-log in MySQL 5.1+)
start-up parameter. The log writes any query being executed by
MySQL to a file with limited amount of additional information.
The other is slow log enabled by
--log-slow-queries parameter (MySQL 5.1 requires
also --slow-query-log), which was designed to store
poorly performing queries that run at least 2 seconds. Percona
actually extended the slow log to, among others, include any
query regardless of the execution time.
The problem is that for both you need to prepare earlier either by enabling the logging before starting the database instance or, even more work, by applying the patch and rebuilding the entire database from sources.
I know that many …
[Read more]