I need to get the long running queries on mysql server for alerting purpose. Found a way but it doesn't work:

show full processlist;

It shows Select sleep(10); but doesn't show select * from my_custom_table;

  • show full processlist shows connections, but only running queries. – Daniel Farrell Sep 27 at 15:34

You're probably going to like the mysql slow query log; see https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html . In a nutshell, it can log all queries that take longer than a given threshold for later analysis.

Please be sure to look for the version of the doc that corresponds with your mysql version, as this is a fast moving project these days and newer versions may have features that older versions don't .

Finally, be aware that the slow query log can fill up hard disks very quickly, so you have to keep an eye on things when it's enabled.

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.