Lock: frozenid
Waiting to update pg_database.datfrozenxid and pg_database.datminmxid
PostgreSQL wait event dossier
ClassLock
Event
frozenid
VersionsPG 13-18
Evidence3 source location(s)
Official description
Waiting to update pg_database.datfrozenxid and pg_database.datminmxid
| PG 13 | PG 14 | PG 15 | PG 16 | PG 17 | PG 18 |
|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Trigger mechanism
PG_WAIT_LOCK at src/backend/storage/lmgr/proc.c:1487 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:420. The instrumented operation is: Waiting to update pg_database.datfrozenxid and pg_database.datminmxid. The lock manager could not grant the frozenid heavyweight lock immediately. ProcSleep reports the lock wait and parks the backend on the lock’s wait queue until owners release or the request is cancelled.
Normal or trouble?
- Normal: Sub-second handoff during ordinary writes or planned DDL can be normal.
- Investigate: Investigate once a user-facing wait breaches its latency objective, a blocking chain grows, or the root holder is idle in transaction.
Diagnostic SQL
Sessions waiting on Lock/frozenid
Current Lock cohort
Lock and relation context for these sessions
Response
- Build the pg_blocking_pids graph to its root.
- Inspect the root holder’s state, transaction age, and business purpose.
- Choose cancellation, timeout, or workload sequencing only after identifying the safest root action.
Source evidence
- PostgreSQL 18.6 · src/backend/storage/lmgr/proc.c:1487 —
PG_WAIT_LOCK - PostgreSQL 18.6 · src/backend/utils/activity/wait_event_names.txt:420 —
frozenid - PostgreSQL 18.6 · src/backend/utils/adt/lockfuncs.c:31 —
frozenid
Related controls and signals
- GUCs: [guc:lock_timeout] · [guc:deadlock_timeout]
- Metrics: [metric:waiting_sessions] · [metric:wait_event_share] · [metric:blocked_sessions] · [metric:locks_per_backend]