进程与事务的查询SQL

1.查看进程

SHOW PROCESSLIST;

2.查看是否锁表

SHOW OPEN TABLES WHERE In_use > 0;

3.查看正在锁的事务

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;

4.查看等待锁的事务

SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;

5.查询 正在执行的事务

SELECT * FROM information_schema.INNODB_TRX;