I have the MySQL slow log feature enabled: http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
But sometimes the query_times are high simply due to high CPU load.
How can I append the current CPU load to each entry in the MySQL slow log (it writes to a file)?
The CPU may be high due to the slow query.
MySQL does not monitor your CPU, so you are going to need a 3rd party monitoring tool and compare the times that CPU is high to the times the query (that is logged) is running.
I use AWS, which has some nice monitoring, and I get an alert when the CPU is high, then I can tail the Slow Query Log and see which ones are causing it.
Hope that helps some. But my guess is the CPU is high due to the query and not that the query is slow due to the CPU. Just a guess tho.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With