Log sessions that wait longer than deadlock_timeout for a lock.
At a glance
| Property | Value |
|---|---|
| Parameter | log_lock_waits |
| Category | Logging |
| Default | off |
| Value type | boolean / enum / numeric |
| Change scope | Superuser / reload |
What it does
When on, logs a message whenever a session waits longer than deadlock_timeout to acquire a lock.
How to apply a change
Can be changed at runtime by a superuser for the current session, or globally via reload.
Inspect the current value and source with SHOW log_lock_waits; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'log_lock_waits';.
Tuning guidance
Turn on to diagnose blocking and lock contention — it reveals which queries are stuck behind which locks.