When the database table size is large and the load is high, it is inevitable that the time consumed by an SQL statement is prolonged. Half a month ago, a scheduled task ran for eight hours in the early morning and suddenly fell helpless. Finally, contact the DBA to help kill the SQL process. In fact, this is not complicated. First, find SQLshowprocesslist that occupies CPU too long;
When the database table size is large and the load is high, it is inevitable that the time consumed by an SQL statement is prolonged. Half a month ago, a scheduled task ran for eight hours in the early morning and suddenly fell helpless. Finally, contact the DBA to help kill the SQL process. In fact, this is not complicated. First, find the SQL show processlist statement that occupies the CPU for a long time.-assume that the last SQL statement is in the Query state.
When the database table size is large and the load is high, it is inevitable that the time consumed by an SQL statement is prolonged. Half a month ago, a scheduled task ran for eight hours in the early morning and suddenly fell helpless. Finally, contact the DBA to help kill the SQL process.
In fact, this is not complicated.
First, find the SQL statement that occupies the CPU for a long time.
Show processlist;
-
If the last SQL statement is in the Query state and the Time is too long, the ID of the SQL statement will be locked and killed directly.
Then, kill the process:
Kill QUERY 4487855;
This is all done!
Reference
KILL [CONNECTION | QUERY] thread_id