rds,

How to Kill Thread or Query in AWS RDS

Mar 24, 2022 · 1 min read · Post a comment
How to Kill Thread or Query in AWS RDS

Stoping some threads or queries that may appear in the deadlock queue or locked from the InnoDB engine on AWS RDS is a different thing than self-hosted MySQL or MariaDB. They can potentially increase the database CPU load and cause a lot of problems. If you spot that some transactions are being stuck and they are reaching the max execution time, then you may need to kill the thread or the query itself.

Prerequisites

  • AWS
  • RDS

Solution

Step 1. To get a useful information about the DB status, run:

show engine innodb status;

Step 2. To kill some stuck threads on AWS RDS, run:

CALL mysql.rds_kill(ThreadID)

Step 3. Killing some of the queries on AWS RDS can be done with:

CALL mysql.rds_kill_query(ThreadID) 

Conclusion

Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.