Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show long-running processes

The following MySQL command will show you long-running processes (exceeding 5 seconds in this case).

select * from information_schema.processlist where command <> 'sleep' and time > 5;

You can run it from console to view those happening now, or you could make a script to poll it periodically, with something like:

echo "select * from information_schema.processlist where command <> 'sleep' and time > 5;" | mysql > long-running.log

(See also https://serverfault.com/questions/416380/log-slow-queries-killed-before-completion/858093)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment