(轉)批量 kill mysql 中運行時間長的sql

mysql> show full processlist;
+--------+------+---------------------+------+---------+------+----------+-----------------------+
| Id     | User | Host                | db   | Command | Time | State    | Info                  |
+--------+------+---------------------+------+---------+------+----------+-----------------------+
| 559818 | root | 10.253.124.77:46824 | NULL | Sleep   |   52 |          | NULL                  |

select concat('kill ',Id,';') from information_schema.processlist where db='szdj'  and Command='Sleep' order by time desc limit 20;
mysql> select concat('kill ',Id,';') from information_schema.processlist where db='szdj'  and Command='Sleep' order by time desc limit 5;
+------------------------+
| concat('kill ',Id,';') |
+------------------------+
| kill 593948;           |
| kill 594523;           |
| kill 594588;           |
| kill 593550;           |
| kill 594449;           |
+------------------------+

鼠標 Alt 選中目標:
kill 593948;
kill 594523;
kill 594588;
kill 593550;
kill 594449;

在sql命令行執行選中目標,完成操做。mysql

相關文章
相關標籤/搜索