---
title: "KILL statement"
description: "Stop a running query or end another session's transaction with the CoraDB KILL statement, and find the transaction index."
url: "https://www.coradb.ai/manual/sql/query/kill.html"
markdown_url: "https://www.coradb.ai/manual/markdown/sql/query/kill.md"
product: "CoraDB"
version: "1.0"
keywords: "kill statement, kill query, kill transaction, cancel query, terminate session, tran_index, coradb kill"
---

# KILL statement

The **KILL** statement stops work done by another session: either the statement it is running, or its whole transaction and connection. It is the SQL counterpart of the [coradb killtran](https://www.coradb.ai/manual/admin/admin_transactions.html#killtran) utility.

## Syntax

```text
KILL [TRANSACTION | QUERY] tran_index [, tran_index ...]
```

- **KILL TRANSACTION** *tran_index* (the default, same as `KILL` without a modifier): rolls back the transaction with that index and closes its connection.
- **KILL QUERY** *tran_index*: cancels only the statement the transaction is currently running. The transaction and the connection stay open.
- *tran_index*: the transaction index of the session to stop. Several indexes can be listed, separated by commas.

Users in the `DBA` group can stop any transaction; other users can stop only their own.

## Finding the transaction index

Every connected client has a transaction index. List them with the [coradb tranlist](https://www.coradb.ai/manual/admin/admin_transactions.html#tranlist) utility, or in SQL with [SHOW TRANSACTION TABLES](https://www.coradb.ai/manual/sql/query/show.html#show-transaction-tables), whose `Tran_index` column holds the index and whose `Client_db_user`, `Client_program`, `Client_host` and `Query_start_time` columns help identify the session.

## Examples

Cancel the statement that transaction 2 is running, without closing its connection:

```sql
KILL QUERY 2;
```

End transaction 2 and close its connection; its uncommitted changes are rolled back:

```sql
KILL TRANSACTION 2;
```

`KILL` reports no error when no transaction has the given index, so check the index with `tranlist` or `SHOW TRANSACTION TABLES` first.

> **Warning:**
> `KILL TRANSACTION` rolls back all uncommitted work of that session. Make sure you have the right index, especially when application servers keep many connections open.


## See also

- [Transactions](https://www.coradb.ai/manual/sql/transaction.html)
- [coradb tranlist and coradb killtran](https://www.coradb.ai/manual/admin/admin_transactions.html#tranlist)
