IT lexicon › Database › Lock wait timeout

Lock wait timeout

Database På svenska → Updated: 2026-11-11

A time limit for how long a transaction may wait for a lock before the system aborts it to prevent deadlocks.

Lock wait timeout is a safety mechanism against deadlocks and slow concurrency. When transaction A needs a lock held by transaction B, A waits. But if B is waiting for a lock from A, both wait forever—a deadlock. A timeout says "if you can't get the lock in N seconds, roll back and try again". Timeout values vary dramatically: interactive queries might use 1-5 seconds, while batch jobs can tolerate minutes. Too short a timeout causes false aborts and wasted work; too long a timeout makes deadlocks frustratingly slow to resolve. Databases like PostgreSQL are conservative (deadlock detected immediately) while others like Oracle default to 0 (no timeout) and require explicit configuration. Some applications implement their own retry logic on top of database-level timeouts.

← Back to the lexicon