MySQL How-To: Which SQL statements are running right now?

Here’s the basics:

SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;

Now these results can be a bit daunting, so you might want to refine your lookup — especially if you have at least a vague idea of what your expecting to find:

SELECT * 
FROM INFORMATION_SCHEMA.PROCESSLIST 
WHERE INFO REGEXP 'FROM too_many_rows_why_did_i_do_this';

As you may know, the output is the same as executing the following:

SHOW FULL PROCESSLIST;

However, unlike the above, you can run full SELECT queries against it.

Note: applies only to MySQL versions >= 5.1.17

Author: Alex T. Silverstein

A developer who wants to help you and himself by writing down good tidbits for free

Leave a Reply

Your email address will not be published. Required fields are marked *