我遇到了一个问题,MySQL似乎会在慢查询日志中记录比指定时间更快的查询。我已经将MySQL配置为记录以下内容:
Server version: 5.1.54-1ubuntu4-log
+---------------------+-------------------------------+
| Variable_name | Value |
+---------------------+-------------------------------+
| log_slow_queries | ON |
| long_query_time | 2.000000 |
| slow_query_log | ON |
| slow_query_log_file | /var/log/mysql/mysql-slow.log |
+---------------------+-------------------------------+
4 rows in set (0.00 sec)然而,在我缓慢的查询日志中,我可以看到它正在记录亚秒级的查询:
# Time: 121116 17:09:00
# User@Host: user[user] @ ip-10-x-x-x.ec2.internal [x.x.x.x]
# Query_time: 0.007098 Lock_time: 0.000075 Rows_sent: 50 Rows_examined: 2693我已经使用'SET GLOBAL ...‘动态设置了上面的变量,但在此之前,long_query_time被设置为1.000000秒。
你知道为什么MySQL可以记录比指定的更快的查询吗?
发布于 2012-11-17 01:24:32
根据the documentation的说法,还有另一个选项可能会导致查询记录在缓慢的查询日志中:
log_queries_not_using_indexes
https://stackoverflow.com/questions/13421266
复制相似问题