↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

GUC Parameters / Reporting and Logging

log_lock_waits

Read the PG 18 manual

Controls whether a log message is produced when a session waits longer than deadlock_timeout to acquire a lock.

Reading PG 18current·documented in 20 of 24 versions, 8.3 to 20

Type
bool
Context
superuser
Measured default
off
Unit
—
Metadata snapshot
18

Definition PG 18 manual

Controls whether a log message is produced when a session waits longer than deadlock_timeout to acquire a lock. This is useful in determining if lock waits are causing poor performance. The default is off. Only superusers and users with the appropriate SET privilege can change this setting.

Measured default history
Version intervalDefault
9.0 – 18off
19 – 19on
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source

How it works

log_lock_waits logs long lock waits. A wait is logged after deadlock_timeout, so the diagnostic threshold and deadlock detector cadence are coupled.

log_lock_waits is a SUPERUSER-context setting. Superuser or a role granted the appropriate SET privilege can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.

It changes emitted diagnostic data rather than query semantics, but volume, sensitive content, log_line_prefix, destinations, collector throughput, and retention determine operational cost and usefulness.

Operational considerations

Changing log_lock_waits in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.

Enabling richer logging without budgeting collector throughput, storage, retention, and downstream query cost.

Writing SQL text, bind values, identities, or host data without a redaction and access-control policy.

Changing deadlock_timeout without realizing it also changes when lock-wait diagnostics appear.

Workload guidance

OLAP: Analytical jobs can justify richer log_lock_waits telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.

OLTP: Tune log_lock_waits against an explicit observability question and a measured log-volume budget. Prefer selective thresholds, sampling, or role-level overrides over indiscriminate capture.

SMALL: Keep log_lock_waits useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency.

Version history 4
  1. 18 → 19 changed
  2. 14 → 15 changed
  3. 9.1 → 9.2 changed
  4. 8.2 → 8.3 added

Related entries

Further reading

Definition snapshot: english-manuals:a78d777e4957b4178ae99fe3dce… · English manual source