jack
jack

Reputation: 17881

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.

Upvotes: 7

Views: 2225

Answers (1)

user262976
user262976

Reputation: 2074

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.

Upvotes: 3

Related Questions