今天用户报出来一个问题:
show full processlist;时出现下面的情况:
|
| 46977247 | common | % | common | Connect | 391 | updating |
| 46977311 | common | % | common | Connect | 331 | updating |
| 46977312 | common | % | common | Connect | 330 | updating |
| 46977406 | common | % | common | Connect | 237 | updating |
| 46977413 | common | % | common | Connect | 231 | updating |
| 46977446 | common | % | common | Connect | 201 | updating |
| 46977459 | common | % | common | Connect | 189 | updating |
| 46977462 | common | % | common | Connect | 186 | updating |
| 46977477 | common | % | common | Connect | 171 | updating |
| 46977489 | common | % | common | Connect | 159 | updating |
| 46977490 | common | % | common | Connect | 158 | updating |
| 46977493 | common | % | common | Connect | 155 | updating |
| 46977496 | common | % | common | Connect | 152 | updating |
| 46977511 | common | % | common | Connect | 137 | updating |
| 46977519 | common | % | common | Connect | 129 | updating |
| 46977523 | common | % | common | Connect | 125 | updating |
| 46977526 | common | % | common | Connect | 123 | updating |
| 46977530 | common | % | common | Connect | 119 | updating |
| 46977532 | common | % | common | Connect | 117 | updating |
| 46977533 | common | % | common | Connect | 116 | updating |
| 46977537 | common | % | common | Connect | 113 | updating
host那一列显示的只是一个 %号,没有显示ip地址。
这看起来有点不应该。 想了一下原因:没有想到,网上也不没有找到答案。
灵感出现在一瞬间:
使用下面的方式模拟:
delimiter ;;
CREATE DEFINER=`root`@`%` PROCEDURE `insert_pro`()
begin
DECLARE counter INT DEFAULT 0;
insert_loop: loop
set counter=counter+1;
insert into test values (counter,counter,counter);
if counter=10000 then
leave insert_loop;
end if;
end loop insert_loop;
end
;;
CREATE EVENT IF NOT EXISTS e_test
ON SCHEDULE EVERY 10 SECOND
ON COMPLETION PRESERVE
DO CALL test.insert_pro();
然后去show full processlist;
mysql> show full processlist;
+----+-----------------+-----------------+------+---------+------+-----------------------------+----------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-----------------+-----------------+------+---------+------+-----------------------------+----------------------------------------------------+
| 1 | event_scheduler | localhost | NULL | Daemon | 2 | Waiting for next activation | NULL |
| 64 | root | localhost:34176 | test | Sleep | 52 | | NULL |
| 65 | root | localhost:34177 | NULL | Query | 0 | System lock | show full processlist |
| 74 | root | % | test | Connect | 0 | query end | insert into test values (counter,counter,counter) |
| 75 | root | % | test | Connect | 0 | query end | insert into test values (counter,counter,counter) |
+----+-----------------+-----------------+------+---------+------+-----------------------------+----------------------------------------------------+
5 rows in set (0.00 sec)
可以模拟出这种情况。
其实就是event调用的结果。
转载请注明源出处
QQ 273002188 欢迎一起学习
QQ 群 236941212
oracle,mysql,mongo 相互交流