SHOW PROCESSLIST;
SHOW FULL PROCESSLIST;
KILL 会话ID;
查询过滤当前xxxx库正在执行的sql
select * from information_schema.PROCESSLIST where db = ‘xxx’ and STATE = 'executing' ORDER BY TIME\G;
查询当前正在执行的sql
select * from information_schema.PROCESSLIST where STATE = 'executing' ORDER BY TIME\G;
查询非Sleep连接状态的语句
select * from information_schema.PROCESSLIST where COMMAND != 'Sleep' ORDER BY TIME DESC\G;
查询非Sleep连接状态的超过120s语句
select * from information_schema.PROCESSLIST where COMMAND != 'Sleep' and time > 2*60 ORDER BY TIME DESC\G;
拼接kill 进程id的慢sql
select concat('kill ', id, ';') from information_schema.PROCESSLIST where COMMAND != 'Sleep' and time > 2*60 ORDER BY TIME DESC\G;
网友评论