锁表查询
show innodbstatus\G;
show variables like '%timeout%';
show status like '%lock%';
show status like 'Table%';
Table_locks_immediate 指的是能够立即获得表级锁的次数
Table_locks_waited 指的是不能立即获取表级锁而需要等待的次数
当前锁表状态
show OPEN TABLES where In_use > 0;
查询表被锁进程
show processlist;
查看正在锁的事物:
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
查看等待锁的事物:
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
当前运行的所有事务:
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;