You can execute the KILL statement to kill an SQL thread that is running on a PolarDB-X instance.

Syntax

You can kill an SQL thread by using the following methods:

  • Execute the following statement to kill the logical and physical SQL threads of a connection, and then close the connection:
    KILL PROCESS_ID
    Note
    • You can execute the SHOW [FULL] PROCESSLIST statement to query the value of PROCESS_ID.
    • PolarDB-X does not support KILL QUERY.
  • Execute the following statement to kill a specified physical SQL thread:
    KILL 'PHYSICAL_PROCESS_ID'

    Examples

    KILL '0-0-521570'; 
    Query OK, 0 rows affected (0.01 sec)
    Note
    • You can execute the SHOW PHYSICAL_PROCESS_ID statement to query the value of PHYSICAL_PROCESS_ID.
    • The value of PHYSICAL_PROCESS_ID is a string instead of a numeric value. Therefore, you must enclose the value of PHYSICAL_PROCESS_ID in double quotation marks (").
  • Kill all physical SQL threads that are running on a PolarDB-X instance.
    KILL 'ALL'