Always investigate why queries run long – missing indexes, bad query structure, lock contention, or just too much data. Killing is a band-aid, not a cure.

: You can query the information_schema.processlist table for similar information.

: This command lists the current running queries. You can filter by time to find queries that have been running for a long time.

#!/bin/bash

-- Usage CALL kill_long_running_queries(120); -- kills queries running > 2 minutes

Suppose you have a long running query with a thread id of 123 :

Scroll To Top
Categories
Close

Login

Shopping Cart

Close

Your cart is empty.

Start Shopping

Close
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare