Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can "set timestamp" be a slow query?

My slow query log is full of entries like the following:

# Query_time: 1.016361  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
SET timestamp=1273826821;
COMMIT;

I guess the set timestamp command is issued by replication but I don't understand how set timestamp can take over a second. Any ideas of how to fix this?

like image 602
Peder Avatar asked May 14 '10 09:05

Peder


People also ask

Why is my SQL query so slow?

Queries can become slow for various reasons ranging from improper index usage to bugs in the storage engine itself. However, in most cases, queries become slow because developers or MySQL database administrators neglect to monitor them and keep an eye on their performance.

What is a slow query?

The slow query log consists of SQL statements that take more than long_query_time seconds to execute and require at least min_examined_row_limit rows to be examined. The slow query log can be used to find queries that take a long time to execute and are therefore candidates for optimization.


1 Answers

Timestamp is a data type and a built-in function in MySQL. What are you trying to achive with the following statement?

SET timestamp=1273826821;

UPD: I am sorry, I didn't know about the used MySQL hacks.

It seems that SET TIMESTAMP is used as a solution to exclude some queries from the slow log.

The OP is using the Microslow patch to enhance stat info in the slow query log, and the statement is common before statements on InnoDB tables.

Thus, the answer to OP's question is that the COMMIT statement is the slow query and not the SET TIMESTAMP.

like image 174
newtover Avatar answered Sep 20 '22 00:09

newtover