Slow queries that block resources or never complete can destabilize your workload. Use KILL QUERY to stop a running SQL statement.
The typical workflow is:
Run
SHOW PROCESSLISTto find the ID of the target query.Run
KILL QUERYwith that ID to stop it.
Applicable engines and versions
| Engine | Supported versions |
|---|---|
| LindormTable | 2.6.2 and later |
| LindormTSDB | All versions |
Important
Lindorm SQL must be version 2.6.3.2 or later. To check your Lindorm SQL version, see SQL versions.
Syntax
KILL QUERY string_literalParameters
| Parameter | Description |
|---|---|
string_literal | The ID of the SQL statement to stop. Lindorm assigns a unique ID to each SQL statement by default. Retrieve the ID by running SHOW PROCESSLIST. |
Example
The following example shows how to identify and stop a slow query.
Step 1: Run SHOW PROCESSLIST to find the ID of the query you want to stop.
SHOW PROCESSLIST;Step 2: Copy the ID from the output and pass it to KILL QUERY.
KILL QUERY '6b0dbbbe-f294-4892-a129-05cd96f8afd0';Note
This operation cannot be undone. Confirm the query ID in the SHOW PROCESSLIST output before running KILL QUERY.
What's next
SHOW PROCESSLIST — list active queries and retrieve query IDs