LWLock: ProcArray
Waiting to access the shared per-process data structures (typically, to get a snapshot or report a session’s transaction ID)
PostgreSQL wait event dossier
ClassLWLock
Event
ProcArray
VersionsPG 13-18
Evidence3 source location(s)
Official description
Waiting to access the shared per-process data structures (typically, to get a snapshot or report a session’s transaction ID)
| PG 13 | PG 14 | PG 15 | PG 16 | PG 17 | PG 18 |
|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Trigger mechanism
ProcArrayLock protects the shared PGPROC/PGXACT arrays used for snapshots, transaction visibility, and transaction end. Snapshot acquisition and updates to process transaction state must briefly coordinate through it.
Normal or trouble?
- Normal: Brief waits are expected on busy OLTP systems that start and finish many transactions.
- Investigate: Persistent contention can accompany extreme connection counts, snapshot-heavy workloads, long transactions, or bursts of transaction completion.
Diagnostic SQL
Sessions waiting on LWLock/ProcArray
Current LWLock cohort
Lock and relation context for these sessions
Response
- Measure active backends and transaction age, not only total connections.
- Find long-running and idle-in-transaction sessions that keep visibility horizons old.
- Pool connections, shorten transactions, and avoid synchronized bursts of tiny transactions.
Source evidence
- PostgreSQL 18.6 · src/backend/access/transam/xlog.c:6121 —
ProcArray - PostgreSQL 18.6 · src/backend/storage/lmgr/lwlock.c:739 —
pgstat_report_wait_start - PostgreSQL 18.6 · src/backend/utils/activity/wait_event_names.txt:316 —
ProcArray
Related controls and signals
- GUCs: [guc:max_connections] · [guc:idle_in_transaction_session_timeout]
- Metrics: [metric:waiting_sessions] · [metric:wait_event_share] · [metric:active_backends] · [metric:oldest_transaction_age]
Typical incident pattern
An application reconnect storm creates thousands of short transactions while a reporting query holds an old snapshot, amplifying ProcArray traffic.