Take the 2-minute tour ×
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. It's 100% free, no registration required.

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?
share|improve this question
add comment

1 Answer 1

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:

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:

share|improve this answer
add comment

Your Answer

 
discard

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.