ByteHouse currently supports terminating queries (kill query).
The kill query statement forcibly terminates the currently running query.
If you only have read-only access (SELECT, SHOW, GET), you can only terminate queries that you have created. You can navigate through ByteHouse Console > access control > user > data privilege to view your data privileges. To obtain higher data management permissions, please contact the administrator for configuration. For details, see data privilege management.
KILL QUERY WHERE <where expression to SELECT FROM system.processes query> [SYNC|ASYNC|TEST] [FORMAT format]
The parameter descriptions are as follows:
| | | | \
| Parameter | Required | Description | |||
|---|---|---|---|---|---|
| \ | |||||
WHERE <where expression to SELECT FROM system.processes query> | Yes | Use the WHERE expression to define the conditions for the queries to be terminated. This example selects queries that satisfy the condition from the system.processes table and terminates them. You can replace system.processes with your table name. | |||
| \ | |||||
| [SYNC | ASYNC | TEST] | No | Optional values. Specify the type of query termination. Supported settings are SYNC, ASYNC, and TEST. | \ |
| \ | |||||
| * ASYNC: By default, asynchronous forced termination is used. Asynchronous termination will forcibly execute without confirming whether the current query has stopped. | \ | ||||
* SYNC: Synchronous termination waits for all queries to stop before terminating the query and displays process information. The information returned by SYNC is shown in the kill_status column and includes the following types: | \ | ||||
* finished – The query has been successfully terminated. | \ | ||||
* waiting – The termination signal has been sent; waiting for the query to end. | \ | ||||
| * Other values explain the reason why the query cannot be terminated. | \ | ||||
| * TEST: TEST only checks the user's privileges and lists the operations to be terminated. | |||||
| \ | |||||
| [FORMAT format] | No | Optional values. Defines the output format of the command execution result. The default output format is TabSeparated. Common supported formats include TabSeparated, CSV, Pretty, JSON, JSONEachRow, XML, and more. |
Obtain the list of queries that have not yet completed.
SHOW PROCESSLIST WHERE query like 'SELECT%'
Terminate the query.
KILL QUERY WHERE initial_query_id='2-857d-4xxx-9xxx-327xxxxx0a90'
Obtain the list of queries that have not yet completed.
SHOW PROCESSLIST
Terminate the queries.
KILL QUERY WHERE user='username' SYNC