Mysql Kill — A Query !link!

-- Find long-running queries SELECT id, user, time, state, info FROM information_schema.PROCESSLIST WHERE command != 'Sleep' AND time > 60; -- Kill one KILL QUERY <id>;

Here’s a short story to illustrate killing a MySQL query in a real-world scenario. mysql kill a query

She quickly checked the execution plan (EXPLAIN) — sure enough, no index on created_at and a full table scan on products with a wildcard LIKE . A perfect storm. -- Find long-running queries SELECT id, user, time,

It was 2:13 AM on a Tuesday. Maya, the only on-call database engineer, jolted awake by a relentless buzz from her phone. -- Find long-running queries SELECT id

She SSH’d into the production database server and ran the usual triage:

“API latency > 5 seconds. 500 errors spike.”

She typed:

mysql kill a query