Avoid waiting too long on blocked locks.
Section: locking and concurrency
Set lock wait timeout for the session
sql
sql
SET SESSION innodb_lock_wait_timeout = 10;Explanation
Shorter timeouts are often helpful in APIs that should fail fast under contention.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing locking and concurrency
Inspect InnoDB lock and transaction state
Display detailed InnoDB diagnostics.
Lock selected rows for update
Prevent concurrent modifications to matched rows inside a transaction.
Lock rows for shared reads
Read rows while protecting against conflicting writes.
Set transaction isolation level
Control read consistency and concurrency behavior.