简体   繁体   English

解释mysqldumpslow结果

[英]Interpreting mysqldumpslow results

I have modified mysql config to log slow queries 我已修改mysql配置以记录慢速查询

slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

And interpreting them with mysqldumpslow . 并用mysqldumpslow解释它们。 One of the results is as follows 结果之一如下

Count: 28  Time=0.21s (5s)  Lock=0.00s (0s)  Rows=5.0 (140), root[root]@localhost

Question: what do the numbers in brackets mean? 问题:方括号中的数字是什么意思?

The query does take about 0.21s when run with mysql (or via mysql GUI's); 当使用mysql (或通过mysql GUI)运行时,查询的时间大约为0.21s。 however when making a request to a page the time span is more like 5 seconds. 但是,当请求页面时,时间跨度更像是5秒。

Extra read: mysqldumpslow: What does these fields indicate..? 额外阅读: mysqldumpslow:这些字段指示什么?

It seems that the number in brackets (5s) is the average Time multiplied by Count and floored. 括号中的数字(5s)似乎是平均Time乘以Count并计算为下限。

28 * 0.21 = 5.88s ~ 5s

The same applies to rows 行同样如此

28 * 5.0 = 140 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM