2010-03-20 180 views
7

MySQL慢查询日志通常会按顺序显示一堆以下条目。MySQL缓慢查询

SET timestamp=1268999330; 
commit; 
# [email protected]: username[username] @ localhost [] 
# Query_time: 4.172700 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0 
SET timestamp=1268999330; 
commit; 
# [email protected]: username[username] @ localhost [] 
# Query_time: 3.628924 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0 
SET timestamp=1268999330; 
commit; 
# [email protected]: username[username] @ localhost [] 
# Query_time: 3.116018 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0 
... 

通常6-7按顺序提交查询。任何人他们是什么和他们每个人的前面的查询是什么?

在此先感谢。

回答

3

set timestamp命令会影响now返回的值以及自动时间戳列在修改其行时接收的值。

这对复制和回放日志时是必需的。依赖于当前时间的查询语义将始终完全匹配。 (注sysdate无视set timestamp不像now

日志将确保时间戳记录set timestamp每当有一个新的连接,一个MySQL平,或任何语句执行。

+2

@jxac,感谢您的解释,但是“查询时间”数字(4.172700,3.628924,3.16018)意味着那些“提交”语句需要超过3秒才能运行? – jack 2010-03-20 08:52:44