#检查有锁表的session,或者长时间执行的慢查询
show full processlist;
#查询表是否在使用
show open tables where in_use >0;
#查看正在运行、未提交的事务,获取session id ,字段为 trx_mysql_thread_id
select * from information_schema.INNODB_TRX;
#查看锁表,mysql8可能不一样
#mysql8
select * from sys.innodb_lock_waits;
select * from performance_schema.data_locks;
select * from performance_schema.data_lock_waits;
#mysql5
SELECT * FROM information_schema.INNODB_LOCKs;
SELECT * FROM information_schema.INNODB_LOCK_waits;
#找到指定session,确认以后杀掉异常id
select * from performance_schema.processlist where id = 42007;
kill 42007
#检查查询失败的sql语句
select * from performance_schema.events_statements_current;
#查看历史事务
select * from performance_schema.events_statements_history;
https://www.cnblogs.com/digdeep/p/4892953.html
标签:表处理,INNODB,mysql,performance,id,select,schema From: https://www.cnblogs.com/gkmin/p/16735278.html