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 utility.
Syntax
Section titled “Syntax”KILL [TRANSACTION | QUERY] tran_index [, tran_index ...]- KILL TRANSACTION tran_index (the default, same as
KILLwithout 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
Section titled “Finding the transaction index”Every connected client has a transaction index. List them with the coradb tranlist utility, or in SQL with 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
Section titled “Examples”Cancel the statement that transaction 2 is running, without closing its connection:
KILL QUERY 2;End transaction 2 and close its connection; its uncommitted changes are rolled back:
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.