执行如下命令
1 | select unix_timestamp(now()) as Systime; show global status where Variable_name in('com_select','com_insert','com_delete','com_update'); |
注意上面是两条命令,第一条是获取一下系统的时间戳,第二条是获取删除、插入、查找、更新的次数,执行结果如下:
1 | mysql> select unix_timestamp(now()) as Systime; show global status where Variable_name in('com_select','com_insert','com_delete','com_update'); |
过一段时间后,再执行一遍上面的命令,得到新的时间戳和次数,有了两个次数和时间间隔,就可以很方便的计算每秒执行次数了!
什么?你不会?!给你个公式吧:
1 | (后一次的次数 - 前一次的次数) / (后一次的时间戳 - 前一次的时间戳) = 每秒执行的次数 |