Controls whether a detailed log message is produced when a lock acquisition fails.
At a glance
| Property | Value |
|---|---|
| Parameter | log_lock_failures |
| Category | Error Reporting and Logging |
| Default | off |
| Value type | boolean (on/off) |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 18, 19 (added in 18) |
What it does
Controls whether a detailed log message is produced when a lock acquisition fails. This is useful for analyzing the causes of lock failures. Currently, only lock failures due to SELECT NOWAIT is supported. The default is off. Only superusers and users with the appropriate SET privilege can change this setting.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW log_lock_failures; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'log_lock_failures';.
Tuning guidance
Tune this for observability versus log volume, not for raw performance. More verbose logging helps diagnose problems but costs disk and I/O; quieter logging saves space but hides detail. Pick a level your log pipeline can store and search, and raise verbosity temporarily when investigating an incident.