tags:

views:

170

answers:

1
+3  Q: 

MySQL slow queries

The MySQL slow query log often shows a bunch of following entries in sequence.

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

Usually 6-7 "commit" queries in sequence. Anyone what they are and what's the preceding query of each of them?

Thanks in advance.

A: 

the set timestamp command affects the value returned by now and the value that auto timestamp columns receive when their rows are modified.

this is necessary for replication and when playing back the log. query semantics that depend on the current time will always match exactly. (note sysdate disregards set timestamp unlike now)

the log will make sure the timestamp is recorded with set timestamp whenever there's a new connection, a mysql ping, or any statement executed.

@jxac, thanks for your explanation but are the "Query Time" figures (4.172700, 3.628924, 3.116018) means those "commit" statement took more than 3 seconds to run?
jack