All Products
Search
Document Center

PolarDB:KILL

Last Updated:Mar 28, 2026

Stops a running SQL statement or terminates a database connection in PolarDB-X 1.0.

Prerequisites

Before you begin, ensure that you have:

How it works

PolarDB-X routes SQL through two layers: a logical layer that manages client connections, and a physical layer that executes SQL on the underlying storage nodes. The KILL statement targets each layer differently:

StatementEffect
KILL PROCESS_IDStops all logical and physical SQL on a connection, then closes the connection
KILL 'PHYSICAL_PROCESS_ID'Stops a specific physical SQL statement without affecting the connection
KILL 'ALL'Stops all running physical SQL statements in the database
PolarDB-X 1.0 does not support KILL QUERY. In standard MySQL, KILL QUERY stops the current statement while keeping the connection open. In PolarDB-X 1.0, use KILL PROCESS_ID to stop a connection and all its associated SQL, or KILL 'PHYSICAL_PROCESS_ID' to stop a specific physical statement.

Stop a connection

To stop all SQL on a connection and close it, run:

KILL PROCESS_ID

Get PROCESS_ID by running SHOW [FULL] PROCESSLIST.

Example workflow:

  1. List active connections and find the target process:

    SHOW FULL PROCESSLIST;
  2. Use the Id value from the output to stop the connection:

    KILL 100;

Stop a physical SQL statement

To stop a specific physical SQL statement without closing the connection, run:

KILL 'PHYSICAL_PROCESS_ID'

Get PHYSICAL_PROCESS_ID by running SHOW PHYSICAL_PROCESS_ID.

PHYSICAL_PROCESS_ID is a string, not a number. Always enclose the value in single quotation marks.

Example:

mysql> KILL '0-0-521570';
Query OK, 0 rows affected (0.01 sec)

Stop all physical SQL statements

To stop all running physical SQL statements in the database, run:

KILL 'ALL'