0

My MySQL log directory contains the following files:

7.9K   mysqld.err-old
4.0G   mysqld-slow.log
94     mysql.log
93M    mysqld.err

mysqld-slow.log contains a long list of queries with some metadata.

Questions

  • Which queries are logged into that file?
  • Which tools do I have to analyze the runtime of slow queries?
1

Queries that exceed the number of second set by long_query_time land in the slow query log.

If you want to parse and examine the mysqld-slow.log file, please use mysqldumpslow.

If you want better ways to examine slow queries, you may want to apply one of the following suggestions:

SUGGESTION #1

Keep in mind that mysqld-slow.log contains slow queries that have finished. It will not record long running queries that are in progress. If you would like to catch queries in the act of running long before they are recorded in the slow query log, please look over my past posts on how to set that up in Query Profiles

SUGGESTION #2

If you are using MySQL 5.1+, did you know that you could record the slow log into a MyISAM table? That way, you can query the MyISAM table rather than parsing a large text file.

I have past posts on how to set that up:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.