Skip to main content
Version: Stable-3.5

KILL

Terminates a connection or a query currently being performed by threads executing within StarRocks.

tip

This operation does not require privileges.

Syntax​

KILL [ CONNECTION | QUERY ] { <processlist_id> | <query_id> }

Parameters​

ParameterDescription
Modifier:
  • CONNECTION
  • QUERY
  • With a CONNECTION modifier, the KILL statement terminates the connection associated with the given processlist_id, after terminating any statement the connection is executing.
  • With a QUERY modifier, the KILL statement terminates the statement the connection is currently executing, but leaves the connection itself intact.
  • If no modifier is present, the default is CONNECTION.
processlist_idThe ID of the thread you want to terminate. You can get the IDs of the threads that are being executed using SHOW PROCESSLIST.
query_idThe ID of the query you want to terminate. You can get the IDs of the queries that are pending or being executed using SHOW RUNNING QUERIES or SHOW PROC with '/current_queries' and '/global_current_queries'.

Examples​

mysql> SHOW FULL PROCESSLIST;
+------+------+---------------------+--------+---------+---------------------+------+-------+-----------------------+-----------+
| Id | User | Host | Db | Command | ConnectionStartTime | Time | State | Info | IsPending |
+------+------+---------------------+--------+---------+---------------------+------+-------+-----------------------+-----------+
| 20 | root | xxx.xx.xxx.xx:xxxxx | sr_hub | Query | 2023-01-05 16:30:19 | 0 | OK | show full processlist | false |
+------+------+---------------------+--------+---------+---------------------+------+-------+-----------------------+-----------+
1 row in set (0.01 sec)

mysql> KILL 20;
Query OK, 0 rows affected (0.00 sec)
Rocky the happy otterStarRocks Assistant

AI generated answers are based on docs and other sources. Please test answers in non-production environments.