MySQL的慢查询日志中的时间单位是什么? [英] What is the unit of time in MySQL's slow-query log?

查看:1395
本文介绍了MySQL的慢查询日志中的时间单位是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从基于drupal的web应用程序中查看缓慢的查询日志,并且其中的行如下所示:

I'm looking at the slow query log from a drupal-based webapp, and have lines that look like this:

# Query_time: 3257  Lock_time: 0  Rows_sent: 272  Rows_examined: 272
# Query_time: 1654  Lock_time: 0  Rows_sent: 222  Rows_examined: 222
# Query_time: 3292  Lock_time: 0  Rows_sent: 269  Rows_examined: 269
# Query_time: 1029  Lock_time: 0  Rows_sent: 172  Rows_examined: 172
# Query_time: 2126  Lock_time: 0  Rows_sent: 251  Rows_examined: 251
# Query_time: 1731  Lock_time: 0  Rows_sent: 229  Rows_examined: 229

这些时间是否表示相关查询需要1到3+秒(很慢但并不可怕)的执行时间,或1,000到3,000+秒(完全不能接受)?我知道long_query_time选项是以秒为单位指定的,但是日志消息是否遵循相同的约定,还是改用毫秒?

Are these times indicating that the associated queries took between 1 and 3+ seconds (slow but not terrible) to execute, or between 1,000 and 3,000+ seconds (completely unacceptable)? I understand that the long_query_time option is specified in seconds, but do the log messages follow this same convention, or do they use milliseconds instead?

这是MySQL 5.0.45版.

this is with MySQL version 5.0.45.

推荐答案

以秒为单位. 微秒的分辨率"表示,您可以在小数点后达到微秒的精度(尽管AFAIK需要一个补丁才能以这种精度实际写入)

It's in seconds. The 'resolution of microseconds' means, that you can have up to microsecond precision after a decimal (although AFAIK it need a patch to actually write with such precision)

https://github.com/wvanbergen/request-log-analyzer/wiki/MySQL-slow-query-log

这篇关于MySQL的慢查询日志中的时间单位是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆