Skip to content

Instantly share code, notes, and snippets.

@adamhut
Last active December 11, 2019 18:18
Show Gist options
  • Save adamhut/f38463e5f86109aaa29feaca9299f113 to your computer and use it in GitHub Desktop.
Save adamhut/f38463e5f86109aaa29feaca9299f113 to your computer and use it in GitHub Desktop.
AWS RDS kill a long running query to prevent row level lock

您可以使用 rds_kill 和 rds_kill_query 命令,終止資料庫執行個體上的使用者工作階段或查詢。 首先連接到您的 MySQL 資料庫執行個體,然後發出適當的命令,如下所示。如需詳細資訊,請參閱連接至執行 MySQL 資料庫引擎的資料庫執行個體。

CALL mysql.rds_kill(thread-ID)
CALL mysql.rds_kill_query(thread-ID) 

例如,若要刪除正在執行緒 99 上執行的工作階段,您將輸入下列命令:

CALL mysql.rds_kill(99); 

若要刪除正在執行緒 99 上執行的查詢,您將輸入下列命令:

CALL mysql.rds_kill_query(99); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment