Posts

Showing posts from August, 2023

Lock Wait Timeout Exceeded - Error 1205

Image
 O ne of the most popular InnoDB’s errors is InnoDB lock wait timeout exceeded, for example: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction The above simply means the transaction has reached the innodb_lock_wait_timeout while waiting to obtain an exclusive lock which defaults to 50 seconds. The common causes are: The offensive transaction is not fast enough to commit or rollback the transaction within innodb_lock_wait_timeout duration. The offensive transaction is waiting for row lock to be released by another transaction. The Effects of a InnoDB Lock Wait Timeout InnoDB lock wait timeout can cause two major implications: The failed statement is not being rolled back by default. Even if innodb_rollback_on_timeout is enabled, when a statement fails in a transaction, ROLLBACK is still a more expensive operation than COMMIT. Let’s play around with a simple example to better understand the effect. Consider the following two tables in d