Lock wait timeouts

Even if a transaction is not involved in a deadlock, it might have to wait a considerable amount of time to obtain a lock because of a long-running transaction or transactions holding locks on the tables it needs.

In such a situation, you might not want a transaction to wait indefinitely. Instead, you might want the waiting transaction to abort, or time out, after a reasonable amount of time, called a lock wait timeout.

Related concepts
Avoiding deadlocks
Deadlock detection
Configuring deadlock detection and lock wait timeouts
Debugging Deadlocks
Programming applications to handle deadlocks