Logging & statsSuperuser · per sessiondefault off
log_lock_waits
Logs long lock waits.
How you change it
Superuser · per session
Defaults and ranges on this page were read from pg_settings on live PostgreSQL 18.4. Treat older majors as needing their own check before you copy a value.
What this means
When on, logs a message whenever a session waits longer than deadlock_timeout for a lock. It surfaces lock contention that is not a deadlock -- the slow, blocking waits that make an application feel stalled -- so you can find the blocking query.
When it matters
Turn on in production to get visibility into blocking and long lock waits.
| Default | off |
|---|---|
| Type | bool |
| Change scope | Superuser · per session |
| Category | Logging & stats |
Check the current value
SHOW log_lock_waits;Tradeoffs
- • Off: lock contention is invisible until it becomes a deadlock or a user complaint.
- • On: adds log lines only when waits exceed deadlock_timeout, so volume stays low.
- • Reads the same deadlock_timeout threshold, so the two settings work together.