Last active
November 6, 2018 14:09
-
-
Save dawn360/599f933db36c86f328f47c926acd0683 to your computer and use it in GitHub Desktop.
MySQL Transaction Locks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from INFORMATION_SCHEMA.INNODB_TRX; | |
select * from INFORMATION_SCHEMA.INNODB_LOCKS; | |
SELECT CONCAT('KILL ', trx.trx_mysql_thread_id) kill_statement, trx.trx_mysql_thread_id thd_id, ps.user, ps.host, trx.trx_query FROM INFORMATION_SCHEMA.INNODB_TRX trx JOIN INFORMATION_SCHEMA.PROCESSLIST ps ON trx.trx_mysql_thread_id = ps.id WHERE user != 'system_user'; | |
KILL 17333; | |
-- http://www.markleith.co.uk/2011/05/31/finding-and-killing-long-running-innodb-transactions-with-events/ | |
ALTER EVENT kill_long_transactions DISABLE; | |
ALTER EVENT kill_long_transactions ENABLE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment