mysqlmysql-slow-query-log

MySQL slow query log empty commit


I am using AWS RDS slow log querys on a mysql database. I have a lot of this in the log:

# Query_time: 0.613015  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
use XXXXXXX;
SET timestamp=1567605603;
commit;

Some like this:

# Query_time: 0.575397  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
SET timestamp=1567605603;
commit;

What this means? A transaction was open but without any DML operations?


Solution

  • We can't know from a single entry in the slow query log, but it's likely that this commit was the last statement run after some number of DML statements.

    That is, each statement gets its own entry in the slow query log, including start transaction and commit.

    Unfortunately, the entries in the slow query log don't have a transaction id, so we don't know which statements are part of the same transaction.