Mysql Kill A Query //top\\ -
Query OK, 0 rows affected (0.00 sec) She ran SHOW PROCESSLIST again. The row with Id 19283 was gone — replaced by a single line: KILLED (for a brief moment, then disappeared).
Almost six minutes. That single query was hogging the CPU, locking critical rows, and starving the checkout service.
The next morning, Maya added a monitoring alert for queries running longer than 60 seconds. She also taught the dev team how to catch themselves: mysql kill a query
KILL <connection_id>; -- kills the entire connection, not just the query She never forgot that 2 AM wakeup. And from then on, every SELECT on large tables had to justify its indexes in the design review. “With great SELECT comes great responsibility — and the ability to KILL QUERY when responsibility fails.”
SHOW PROCESSLIST; The output flooded her screen. Dozens of connections. Most were sleeping. But one caught her eye: Query OK, 0 rows affected (0
She SSH’d into the production database server and ran the usual triage:
KILL QUERY 19283; A second later, MySQL responded: That single query was hogging the CPU, locking
Here’s a short story to illustrate killing a MySQL query in a real-world scenario.