Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


  • Which queries are logged into that file?
  • Which tools do I have to analyze the runtime of slow queries?
share|improve this question
up vote 1 down vote accepted

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:


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


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:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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