Can `kill` be executed in TiDB?

  • Kill DML statements:

    First use information_schema.cluster_processlist to find TiDB instance address and session ID, and then run the kill command.

    TiDB v6.1.0 introduces the Global Kill feature (controlled by the enable-global-kill configuration, which is enabled by default). If Global Kill is enabled, just execute kill session_id.

    If the TiDB version is earlier than v6.1.0, or the Global Kill feature is not enabled, kill session_id does not take effect by default. To terminate a DML statement, you should connect the client directly to the TiDB instance that is executing the DML statement and then execute the kill tidb session_id statement. If the client connects to another TiDB instance or there is a proxy between the client and the TiDB cluster, the kill tidb session_id statement might be routed to another TiDB instance, which might incorrectly terminate another session. For details, see KILL.

  • Kill DDL statements: First use admin show ddl jobs to find the ID of the DDL job you need to terminate, and then run admin cancel ddl jobs 'job_id' [, 'job_id'] .... For more details, see the ADMIN statement.