Skip to main content
Query management statements let you monitor and control running queries in an System. For information about system tables containing query data, see Monitoring.

CANCEL

Cancels a running query based on its specific query identifier. The system cancels query execution at the next available pause point, such as between batches of data processing. If the execution of the CANCEL SQL statement fails, you can force the query to terminate immediately by using the KILL SQL statement. To view active queries and their identifiers, see the sys.queries table. A CANCEL statement can return these statuses.
Status MessageDescription
OKThe system successfully terminated the query and restored the resources assigned to its execution.
ID_NOT_FOUNDThe specified query identifier does not exist in the system. The missing identifier can indicate that the query finished execution before the system could abort it.
NOT_AUTHORIZEDThe user does not have UPDATE privilege for the system level to terminate queries.
NO_CONNECTIONThe system lost connection to the database while trying to terminate the query.
NETWORK_COMMS_ERRORCannot communicate across the distributed system to terminate the query.
INTERNAL_ERRORThe system encountered an unexpected error.
Required Privileges Users must have system-level UPDATE privileges to cancel queries. Syntax
SQL
CANCEL query_id
ParameterTypeDescription
query_idstringThe Universally Unique IDentifier (UUID) of the query to cancel. Must be a valid UUID string enclosed in single quotes.
Examples Cancel a specific query with the 9a9eb7e3-3440-4814-871f-7f0584ac2fd8 identifier.
SQL
CANCEL '9a9eb7e3-3440-4814-871f-7f0584ac2fd8';

KILL

Kills a running query identified by its UUID. This SQL statement performs a forceful termination of the query, aborting execution regardless of its current stage. If you want to attempt a more gradual query termination that stops processing at the next pause point, use the CANCEL SQL statement. To view active queries and their identifiers, see the sys.queries table.
Status MessageDescription
OKThe system successfully terminated the query and restored the resources assigned to its execution.
ID_NOT_FOUNDThe provided query identifier does not exist in the system. The missing identifier can indicate that the query finished execution before the system could abort it.
NOT_AUTHORIZEDThe user does not have UPDATE privilege for the system level to terminate queries.
NO_CONNECTIONThe system lost connection to the database while trying to terminate the query.
NETWORK_COMMS_ERRORCannot communicate across the distributed system to terminate the query.
INTERNAL_ERRORThe system encountered an unexpected error.
Required Privileges Users must have system-level UPDATE privileges to kill queries. Syntax
SQL
KILL query_id
Arguments
ParameterTypeDescription
query_idStringThe UUID of the query to kill. Must be a valid UUID string enclosed in single quotes.
Example Kill a specific query based on the UUID 9a9eb7e3-3440-4814-871f-7f0584ac2fd8.
SQL
KILL '9a9eb7e3-3440-4814-871f-7f0584ac2fd8';
System Catalog General SQL Syntax
Last modified on May 27, 2026