1206: The total number of locks exceeds the lock table size
MySQLWhat does it mean?
InnoDB has exhausted the memory allocated for the locks it holds (the lock structures inside the buffer pool). It occurs when a single transaction accumulates too many row/gap locks, and the transaction is rolled back.
Why does it happen?
Very large single transactions: UPDATE/DELETE of millions of rows at once, a WHERE clause without an index that locks the whole table, or an innodb_buffer_pool_size that is too small for the workload. Large batch jobs are the classic trigger.
How to fix it
Split large DML into small batches (e.g. delete/update 10,000 rows at a time with LIMIT in a loop and COMMIT after each batch). Index the WHERE columns to reduce the number of locked rows. As a permanent fix, increase innodb_buffer_pool_size (lock structures are allocated from it). Avoid unnecessarily long transactions.
More from this engine
- 1526ER_NO_PARTITION_FOR_GIVEN_VALUE: Table has no partition for value
- 1049Unknown database 'name'
- 1364Field 'name' doesn't have a default value
- 1236Got fatal error 1236 from master when reading data from binary log
- 1129Host 'host' is blocked because of many connection errors
- 1194Table 'name' is marked as crashed and should be repaired
- 1615Prepared statement needs to be re-prepared