How can “set timestamp” be a slow query?

爷,独闯天下 提交于 2019-11-27 15:03:28

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.

set timestamp appears in each slow query log, so skip this line; commit is the reason why it appears in slow query;

Since so many commit came into slow log, the db machine IO can be the problem, as IO is the bottleneck for committing.

Monitor DB CPU IO wait value, which can not be higher than 1/number of cores. For example, if 8 cores, IO wait should be less than 12%.

iotop can be used to debug which process is reading/writing IO, and iostat can be used to monitor IO.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!