查询出执行时间较长的进程
select * from information_schema.processlist where command != 'Sleep' and time > 5*60 order by time desc;
select * from information_schema.processlist where Command != 'Sleep' order by Time desc;
查看进程
show full processlist;
查询正在执行的事务
SELECT * FROM information_schema.INNODB_TRX;
查看等待锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
关键字段解读:
1、ID:进程ID
2、DB:属于哪个库
3、COMMAND:该进程的状态,比如Sleep、query、killed
4、TIME:时间,该进程执行的时间,单位是秒
5、STATE:该进程的状态,比如执行中或者等待
6、INFO:执行的sql
查看事务表
select trx_state, trx_started, trx_mysql_thread_id, trx_query from information_schema.innodb_trx;
标签:脚本,information,trx,排查,mysql,进程,processlist,schema From: https://www.cnblogs.com/wszzn/p/18140606关键字段解读:
1、trx_state:该事务的状态
2、trx_started:该事物开始执行时间
3、trx_mysql_thread_id:该事物对应的进程ID
4、trx_query:该事务实行的sql
3、DRDS查看某张分表