BufferPin: BufferPin
Waiting to acquire an exclusive pin on a buffer
PostgreSQL wait event dossier
ClassBufferPin
Event
BufferPin
VersionsPG 13-18
Evidence2 source location(s)
Official description
Waiting to acquire an exclusive pin on a buffer
| PG 13 | PG 14 | PG 15 | PG 16 | PG 17 | PG 18 |
|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Trigger mechanism
WAIT_EVENT_BUFFER_PIN at src/backend/storage/buffer/bufmgr.c:5819 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:286. The instrumented operation is: Waiting to acquire an exclusive pin on a buffer. The buffer manager needs an exclusive pin, but another backend still holds a pin on the same shared buffer. It sleeps until the last conflicting pin is released.
Normal or trouble?
- Normal: An isolated sub-second sample can occur during scans or index maintenance.
- Investigate: Treat a wait beyond one second as suspicious, especially when a cursor or idle transaction may keep the page pinned.
Diagnostic SQL
Sessions waiting on BufferPin/BufferPin
Current BufferPin cohort
Lock and relation context for these sessions
Response
- Preserve the waiting query and relation context.
- Find long cursors and idle-in-transaction sessions touching the same relation.
- Cancel only after identifying the safest holder or maintenance victim.
Source evidence
- PostgreSQL 18.6 · src/backend/storage/buffer/bufmgr.c:5819 —
WAIT_EVENT_BUFFER_PIN - PostgreSQL 18.6 · src/backend/utils/activity/wait_event_names.txt:286 —
BUFFER_PIN
Related controls and signals
- GUCs: None directly.
- Metrics: [metric:waiting_sessions] · [metric:wait_event_share]