All Products
Search
Document Center

KILL

Last Updated: Jun 18, 2021

Description

You can execute the KILL statement to close a session.

Note

If you have the PROCESS permission, you can view all sessions. If you have the SUPER permission, you can close all sessions and statements. If you do not have the PROCESS or SUPER permission, you can view or close only your own sessions and statements.

Syntax

KILL [CONNECTION | QUERY] 'sessionid'

Parameters

Parameter

Description

KILL CONNECTION

This statement performs the same operation as a KILL statement that does not contain a modifier. This statement closes the connection that is associated with the specified sessionid.

KILL QUERY

Stop the execution of statements that are being executed in the connection, but leaves the connection intact.

Examples

Stop the execution of the statement that is being executed in session 3221638213, and then close the session.

OceanBase(admin@test)>show processlist;
+------------+-------+--------------------+------+---------+------+--------+------------------+
| Id         | User  | Host               | db   | Command | Time | State  | Info             |
+------------+-------+--------------------+------+---------+------+--------+------------------+
| 3221638212 | admin | 1.11.111.127:11161 | test | Query   |    0 | ACTIVE | show processlist |
| 3221638213 | admin | 1.11.111.127:11161 | test | Query   |    0 | ACTIVE | select "abcedfg" |
+------------+-------+--------------------+------+---------+------+--------+------------------+
1 row in set (0.03 sec)

OceanBase(admin@test)>kill query 3221638213;
Query OK, 0 rows affected (0.01 sec)

OceanBase(admin@test)>kill 3221638212;
Query OK, 0 rows affected (0.01 sec)