This topic describes how to end the execution of an SQL statement in a PolarDB-X 1.0PolarDB-X database by executing the KILL statement.

Prerequisites

You must connect to the PolarDB-X 1.0PolarDB-X database before you can end the execution of an SQL statement in the PolarDB-X 1.0PolarDB-X database by executing the KILL statement. For more information about how to connect to a PolarDB-X 1.0PolarDB-X database, see Step 4: Connect to.

Syntax

The syntax of the KILL command supports the following usages.

  • You can execute the following statement to end the execution of logical and physical SQL statements on a connection and end the connection.
    KILL PROCESS_ID
    Note
    • You can execute the SHOW [FULL] PROCESSLIST statement to query PROCESS_ID.
    • PolarDB-X 1.0PolarDB-X databases do not support KILL QUERY statements.
  • You can execute the following statement to end the execution of a specific physical SQL statement.
    KILL 'PHYSICAL_PROCESS_ID'

    Example

    mysql> KILL '0-0-521570'; 
    Query OK, 0 rows affected (0.01 sec)
    Note
    • You can execute the SHOW PHYSICAL_PROCESS_ID statement to query PHYSICAL_PROCESS_ID.
    • Values in the PHYSICAL_PROCESS_ID column are strings rather than numbers. Therefore, you must enclose the PHYSICAL_PROCESS_ID value in this statement with single quotation marks (').
  • You can execute the following statement to end the execution of all the physical SQL statements in a PolarDB-X 1.0PolarDB-X database.
    KILL 'ALL'