With MySQL or MariaDB, we like to log how often and when lock timeouts occur.

We certainly know how to debug lock timeouts with SHOW ENGINE INNODB STATUS\G or using the table information_schema.innodb_trx.

What we would like to have is something like an option for the slow query log, to log only the lock timeouts. There is even a field like Lock_time which might be useful. Would be the slow query log an option and how would the slow query log act on lock timeouts?

  • When your query times out, it's not executed obviously. Therefor it's not written to the slow query log. The lock_time is the time, how long it took to get the lock. I've never found it useful, or it is buggy. Even when the execution time makes it clear, that it only took so long because of locking issues, the lock_time is always minimal. – tombom Jun 11 '18 at 12:00
  • @tombom Thanks for the info. That would explain, why I could not find a lock timeout in den slow query log. – Trendfischer Jun 11 '18 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.