BufferCleanup wait event (Buffer) — PostgreSQL

PostgreSQL Buffer wait event BufferCleanup: Waiting to acquire an exclusive pin on a buffer. Buffer pin waits can be protracted if another process holds an open cursor that last read data from the buffer in question.

Summary

BufferCleanup is a PostgreSQL Buffer wait event. The official server documentation describes it as: “Waiting to acquire an exclusive pin on a buffer. Buffer pin waits can be protracted if another process holds an open cursor that last read data from the buffer in question.” (verbatim from PostgreSQL’s wait_event_names.txt catalog).

Classification

  • wait_event: BufferCleanup
  • wait_event_type: Buffer
  • Internal enum: WAIT_EVENT_BUFFER_CLEANUP
  • Reported in: pg_stat_activity

What the Buffer class indicates

(Paraphrased explanation.) The process is waiting on a lock or pin associated with a specific shared buffer (introduced as a distinct class in newer PostgreSQL).

How to observe it

(Illustrative query — not from the catalog.) You can see which sessions are currently reporting this wait event in the cumulative statistics view:

SELECT pid, state, wait_event_type, wait_event, query
FROM pg_stat_activity
WHERE wait_event_type = 'Buffer'
  AND wait_event = 'BufferCleanup';

Version applicability

Confirmed present in PostgreSQL major version(s): 19 (verified against each release’s server source).

This wait event was introduced in PostgreSQL 19; it does not appear in earlier releases that were checked.

The machine-readable wait_event_names.txt catalog exists from PostgreSQL 17 onward; presence in PostgreSQL 12–16 was verified directly from the wait-event, lock, and lightweight-lock definitions in those releases’ source code.

References

  • PostgreSQL documentation — Wait Events
  • PostgreSQL source — src/backend/utils/activity/wait_event_names.txt