How to check connections waiting for lock other than an InnoDB row lock in MySQL
Question: How to Check Whether Any Queries Are Waiting for a Lock Other Than an InnoDB Row Lock?
You can use the following query to see of there are any locked queries that has been running for longer than @@long_query_time:
SELECT COUNT(*) AS NumLongRunning, @@long_query_time AS long_running_time
FROM performance_schema.threads
WHERE PROCESSLIST_TIME > @@long_query_time
AND PROCESSLIST_STATE IN (
'Locked', 'Waiting for table', 'Waiting for tables',
'Waiting for table flush', 'Waiting for release of readlock',
'Waiting for event metadata lock', 'Waiting for schema metadata lock',
'Waiting for stored function metadata lock',
'Waiting for stored procedure metadata lock',
'Waiting for table level lock', 'Waiting for table metadata lock',
'Waiting for trigger metadata lock', 'User lock',
'Waiting for global read lock', 'Waiting for backup lock'
);
You can change the filter and data returned as best suited for your purpose.