2012-11-16 145 views
10

我有一个问题,MySQL似乎在慢速查询日志中查询的速度超过指定时间。我已经配置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 
# [email protected]: 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可以记录更快,然后指定的查询?

+2

你有没有指定'任何机会log_queries_not_using_indexes'? –

+0

是的!就是这样。感谢您及时的回复。如果您想提交正式答案,我会选择接受。再次感谢! – DrewVS

回答