# KILL CONNECTION and KILL QUERY

The `KILL CONNECTION` and `KILL QUERY` commands kill the connection on the specified thread. Roll back any query running on the thread.

## Syntax

```
KILL CONNECTION <internal_process_id> [<node_id>]
KILL QUERY <internal_process_id> [<node_id>]
KILL QUERY COMPILE <query_id> [<node_id>]

```

## Arguments

* `query_id` - see note below.
* `internal_process_id` - ID of the thread to kill.
* `node_id` - ID of the node (aggregator) on which the query/thread is running. If the `node_id` is not specified, the query/thread running on the current node is killed.
  > **❗ Important**: You can query the `information_schema.MV_PROCESSLIST` table for the required parameter values, where the `ID` field in the table contains the thread/internal process ID and the `NODE_ID` field contains the ID of the node.For `KILL QUERY COMPILE`, get the ID for the query from the [LMV\_ASYNC\_COMPILES](https://docs.singlestore.com/db/v9.1/reference/information-schema-reference/query-performance-workload-management-and-statistics/lmv-async-compiles.md) table, `ID` column.

## Remarks

* `internal_process_id` - ID of the thread to kill, which can be found by running [SHOW\_PROCESSLIST](https://docs.singlestore.com/db/v9.1/reference/sql-reference/show-commands/show-processlist.md).
* `KILL CONNECTION` will disconnect the client associated with `internal_process_id`. This is the default, meaning that running `KILL <>` will have the same result.
* `KILL QUERY` allows you to kill a query running on any aggregator in the cluster.
* `KILL QUERY` will not disconnect the client associated with `internal_process_id`. Instead, the client will receive an error.
* Any query running on the connection will be rolled back.
* SingleStore checks for the kill bit during any potentially long running loop during query execution and rolls back the query’s transaction if the kill bit is set.
* This command should be run on the master aggregator or a child aggregator node (see [Node Requirements for SingleStore Commands](https://docs.singlestore.com/db/v9.1/reference/sql-reference/cluster-management-commands.md)).
  > **📝 Note**: When killing queries on remote nodes (if a user specifies a `node_id`), the query will only be killed if the user has the `PROCESS` privilege or if `sync_permissions` is enabled.
* Refer to the [Permissions Matrix](https://docs.singlestore.com/db/v9.1/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permissions.

## Example

```sql
KILL CONNECTION 3123;
Query OK, 0 rows affected (0.00 sec)

```

Stopping a query compile:

```sql
SELECT * FROM information_schema.lmv_async_compiles;

```

```output

+--------+--------+--------------------------------------------------------+-------------------+---------+
| ID     | PID    | QUERY_TEXT                                             | TIME_SINCE_SUBMIT | STATUS  |
+--------+--------+--------------------------------------------------------+-------------------+---------+
| 210812 | 899514 | Query (null).'SELECT * FROM accounts WHERE < ... >.  ' |             0.000 | running |
+--------+--------+--------------------------------------------------------+-------------------+---------+
```

```sql
KILL QUERY COMPILE 210812;
```

**Related Topics**

* [SHOW PROCESSLIST](https://docs.singlestore.com/db/v9.1/reference/sql-reference/show-commands/show-processlist.md)

***

Modified at: June 12, 2026

Source: [/db/v9.1/reference/sql-reference/operational-commands/kill-connection-and-kill-query/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/operational-commands/kill-connection-and-kill-query/)

(An index of the documentation is available at /llms.txt)
