![]() |
To see the top 10 queries by execution time:
| Condition | Killable? | Notes | |-----------|-----------|-------| | SELECT in InnoDB | ✅ Yes | Aborts at next safe point | | UPDATE / DELETE (InnoDB) | ✅ Yes | Partial rollback; may leave gaps | | INSERT ... SELECT | ✅ Yes | Inserts done before kill remain | | ALTER TABLE (inplace) | ⚠️ Partial | May wait for metadata lock or continue | | REPAIR TABLE (MyISAM) | ❌ No | Usually not killable until completion | | Stored procedure loop (no CONTINUE HANDLER ) | ✅ Yes | Kills the CALL statement, not the routine | | GET_LOCK() | ✅ Yes | Releases the lock if acquired | | Waiting for metadata lock | ✅ Yes | Kills the waiting query | mysql kill query
SELECT * FROM performance_schema.processlist WHERE COMMAND = 'Query' AND TIME > 10 ORDER BY TIME DESC; To see the top 10 queries by execution
Every database administrator or backend developer has been there. An application slows to a crawl, monitoring dashboards light up red, and users start complaining about timeouts. Somewhere in the database guts, a query is running wild, consuming resources like there is no tomorrow. An application slows to a crawl, monitoring dashboards
KILL <thread_id>;
In some cases, you may not be able to kill a query using the KILL command. Here are some alternative methods:
Indicates if the query is "Sending data," "Searching rows," or "Locked". 2. The KILL QUERY Command
To see the top 10 queries by execution time:
| Condition | Killable? | Notes | |-----------|-----------|-------| | SELECT in InnoDB | ✅ Yes | Aborts at next safe point | | UPDATE / DELETE (InnoDB) | ✅ Yes | Partial rollback; may leave gaps | | INSERT ... SELECT | ✅ Yes | Inserts done before kill remain | | ALTER TABLE (inplace) | ⚠️ Partial | May wait for metadata lock or continue | | REPAIR TABLE (MyISAM) | ❌ No | Usually not killable until completion | | Stored procedure loop (no CONTINUE HANDLER ) | ✅ Yes | Kills the CALL statement, not the routine | | GET_LOCK() | ✅ Yes | Releases the lock if acquired | | Waiting for metadata lock | ✅ Yes | Kills the waiting query |
SELECT * FROM performance_schema.processlist WHERE COMMAND = 'Query' AND TIME > 10 ORDER BY TIME DESC;
Every database administrator or backend developer has been there. An application slows to a crawl, monitoring dashboards light up red, and users start complaining about timeouts. Somewhere in the database guts, a query is running wild, consuming resources like there is no tomorrow.
KILL <thread_id>;
In some cases, you may not be able to kill a query using the KILL command. Here are some alternative methods:
Indicates if the query is "Sending data," "Searching rows," or "Locked". 2. The KILL QUERY Command
Developers, template authors, final users, UI/UX designer: whatever your role we'd like to receive feedback and suggestions (NO support requests), write us at feedback at mosaico.io!
If you need support read here