Lock waits block transaction progress
warningResource ContentionUpdated Feb 14, 2026
Technologies:
How to detect:
Lock waits lasting more than a few seconds indicate blocking queries. One transaction holds a lock that another transaction needs. Can cause query timeouts and application errors.
Recommended action:
Query pg_locks and pg_stat_activity to identify blocking and blocked queries. Review the blocking query to determine if it can be optimized or terminated. Consider adjusting lock timeout settings. Enable log_lock_waits and set deadlock_timeout to 1s for better visibility.