Slow Query Log to find bad/slow queries

  • Thread starter Thread starter mfurgal
  • Start date Start date
Status
Not open for further replies.
M

mfurgal

Guest
The MySQL Database has a startup option to the database that logs any query that took longer than a specified period of time. This would be a great addition to the RDBMS language. The Statement Cache is a good first step in debugging client based performance issues, however in order for it to be used, you need to catch the errant query in the act, meaning the only time you can find the bad query is turning on the statement cache and looking at the data at the exact time of the issue. A better solution is to do what MySQL did with the slow query log. Specify an output file (or default one) and specify the duration that any statement that is accessing the database that exceeds the duration will be written to the log file. It would be good to have the following on the log: Line of code that exceeded the threshold stack trace that got you there if it's a dynamic query what is the query string How many rows were returned How many rows were retrieved to get the result set The duration of the query

Continue reading...
 
Status
Not open for further replies.
Back
Top