现在的位置: 首页 > 综合 > 正文

对 show processlist 的一点解释

2013年01月25日 ⁄ 综合 ⁄ 共 1004字 ⁄ 字号 评论关闭

mysql> show  processlist;
+----+-------------+-----------+------+---------+------+-----------------------------------------------------------------------+-------------------+
| Id | User        | Host      | db   | Command | Time | State                                                                 | Info              |
+----+-------------+-----------+------+---------+------+-----------------------------------------------------------------------+-------------------+
|  1 | root        | localhost | NULL | Query   |    0 | NULL                                                                  | show  processlist |
|  2 | system user |           | NULL | Connect |   29 | Waiting for master to send event                                      | NULL              |
|  3 | system user |           | NULL | Connect |   49 | Has read all relay log; waiting for the slave I/O thread to update it | NULL      

 

上次开会有人问这个time是什么意思,有的人可能误会了,time不是用户登录了多久或者这个线程启动到现在的时间,io  和sql 线程启动的时间是一样的,只是工作时间不一样。

这个time 只是  最后那个state 状态持续的时间,这时间有可能突然从一个很大的值变为很小的值,是因为这状态时可变的。

 

另外id 并不是随机的,它是连接线程,是mysqld 自己内部实现的以种机制。

 

抱歉!评论已关闭.