Skip to content

This is the multi-page printable view of this section. .

Return to the regular view of this page.

I/O waits

File reads, writes, synchronization, allocation, and asynchronous I/O completion.

IO means PostgreSQL has instrumented a file operation and the backend cannot continue until the kernel or another I/O worker makes progress. It says which PostgreSQL file path is involved; it does not, by itself, prove the storage is slow.

Read event + operation + workload phase

Names usually encode both object and operation: DataFileRead, WalSync, SlruWrite, ReorderBufferRead. Ask whether the workload should be performing that operation now, then compare duration and concurrency with pg_stat_io (PG16+) and operating-system latency.

  • Normal: scans read data files, checkpoints sync dirty files, backups read/write, recovery reads WAL.
  • Watch: the same foreground I/O event persists in consecutive samples and device latency or query latency rises.
  • Urgent: many backends queue behind sync/write completion, errors appear, or the affected path reaches saturation/throttling.

Events to recognize

Event First interpretation
DataFileRead Cache miss or scan reading relation data
DataFileWrite Backend/checkpoint path writing relation data
DataFileSync Relation changes are being made durable
WalWrite WAL bytes are being written
WalSync WAL durability boundary is waiting on fsync/fdatasync
SlruRead Transaction-related SLRU page read
BuffileRead Temp/spill file read
AioIoCompletion PG18 AIO work has not completed yet

PG16+ I/O context

SELECT backend_type, object, context,
       reads, read_time, writes, write_time,
       writebacks, fsyncs, fsync_time
FROM pg_stat_io
ORDER BY coalesce(read_time, 0) + coalesce(write_time, 0) + coalesce(fsync_time, 0) DESC;

Common misreads

  • A high count of DataFileRead during an intentional sequential scan can be healthy throughput.
  • WalWrite and LWLock WALWrite are different: one is a file operation, the other internal coordination.
  • Average device latency can hide a saturated single WAL volume or tail-latency spikes.
  • Raising cache size cannot fix every read wait; poor plans and cold one-time scans may simply displace useful pages.

1 - IO: AioIoCompletion

Waiting for another process to complete IO
PostgreSQL wait event dossier
ClassIO EventAioIoCompletion VersionsPG 18 Evidence2 source location(s)

Official description

Waiting for another process to complete IO

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_AIO_IO_COMPLETION at src/backend/storage/aio/aio.c:643 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:196. The instrumented operation is: Waiting for another process to complete IO. PostgreSQL reports AioIoCompletion around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/AioIoCompletion
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'AioIoCompletion'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'AioIoCompletion'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

2 - IO: AioIoUringExecution

Waiting for IO execution via io_uring
PostgreSQL wait event dossier
ClassIO EventAioIoUringExecution VersionsPG 18 Evidence2 source location(s)

Official description

Waiting for IO execution via io_uring

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_AIO_IO_URING_EXECUTION at src/backend/storage/aio/method_io_uring.c:624 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:198. The instrumented operation is: Waiting for IO execution via io_uring. PostgreSQL reports AioIoUringExecution around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/AioIoUringExecution
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'AioIoUringExecution'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'AioIoUringExecution'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

3 - IO: AioIoUringSubmit

Waiting for IO submission via io_uring
PostgreSQL wait event dossier
ClassIO EventAioIoUringSubmit VersionsPG 18 Evidence2 source location(s)

Official description

Waiting for IO submission via io_uring

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_AIO_IO_URING_SUBMIT at src/backend/storage/aio/method_io_uring.c:451 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:197. The instrumented operation is: Waiting for IO submission via io_uring. PostgreSQL reports AioIoUringSubmit around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/AioIoUringSubmit
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'AioIoUringSubmit'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'AioIoUringSubmit'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

4 - IO: BasebackupRead

Waiting for base backup to read from a file
PostgreSQL wait event dossier
ClassIO EventBasebackupRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for base backup to read from a file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/BaseBackupRead (PG 14-16)

Trigger mechanism

WAIT_EVENT_BASEBACKUP_READ at src/backend/backup/basebackup.c:1837 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:541. The instrumented operation is: Waiting for base backup to read from a file. PostgreSQL reports BasebackupRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/BasebackupRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'BasebackupRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'BasebackupRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

5 - IO: BasebackupSync

Waiting for data written by a base backup to reach durable storage
PostgreSQL wait event dossier
ClassIO EventBasebackupSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for data written by a base backup to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/BaseBackupSync (PG 15-16)

Trigger mechanism

WAIT_EVENT_BASEBACKUP_SYNC at src/backend/backup/basebackup_server.c:206 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:544. The instrumented operation is: Waiting for data written by a base backup to reach durable storage. PostgreSQL reports BasebackupSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/BasebackupSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'BasebackupSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'BasebackupSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

6 - IO: BasebackupWrite

Waiting for base backup to write to a file
PostgreSQL wait event dossier
ClassIO EventBasebackupWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for base backup to write to a file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/BaseBackupWrite (PG 15-16)

Trigger mechanism

WAIT_EVENT_BASEBACKUP_WRITE at src/backend/backup/basebackup_server.c:168 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:547. The instrumented operation is: Waiting for base backup to write to a file. PostgreSQL reports BasebackupWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/BasebackupWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'BasebackupWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'BasebackupWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

7 - IO: BuffileRead

Waiting for a read from a buffered file
PostgreSQL wait event dossier
ClassIO EventBuffileRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read from a buffered file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/BufFileRead (PG 13-16)

Trigger mechanism

WAIT_EVENT_BUFFILE_READ at src/backend/storage/file/buffile.c:464 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:550. The instrumented operation is: Waiting for a read from a buffered file. PostgreSQL reports BuffileRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/BuffileRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'BuffileRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'BuffileRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

8 - IO: BuffileTruncate

Waiting for a buffered file to be truncated
PostgreSQL wait event dossier
ClassIO EventBuffileTruncate VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a buffered file to be truncated

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/BufFileTruncate (PG 14-16)

Trigger mechanism

WAIT_EVENT_BUFFILE_TRUNCATE at src/backend/storage/file/buffile.c:989 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:556. The instrumented operation is: Waiting for a buffered file to be truncated. PostgreSQL reports BuffileTruncate around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/BuffileTruncate
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'BuffileTruncate'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'BuffileTruncate'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

9 - IO: BuffileWrite

Waiting for a write to a buffered file
PostgreSQL wait event dossier
ClassIO EventBuffileWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write to a buffered file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/BufFileWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_BUFFILE_WRITE at src/backend/storage/file/buffile.c:541 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:553. The instrumented operation is: Waiting for a write to a buffered file. PostgreSQL reports BuffileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/BuffileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'BuffileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'BuffileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

10 - IO: ControlFileRead

Waiting for a read from the pg_control file
PostgreSQL wait event dossier
ClassIO EventControlFileRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read from the pg_control file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_CONTROL_FILE_READ at src/backend/access/transam/xlog.c:4362 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:205. The instrumented operation is: Waiting for a read from the pg_control file. PostgreSQL reports ControlFileRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ControlFileRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ControlFileRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ControlFileRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

11 - IO: ControlFileSync

Waiting for the pg_control file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventControlFileSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for the pg_control file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_CONTROL_FILE_SYNC at src/backend/access/transam/xlog.c:4328 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:206. The instrumented operation is: Waiting for the pg_control file to reach durable storage. PostgreSQL reports ControlFileSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ControlFileSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ControlFileSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ControlFileSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

12 - IO: ControlFileSyncUpdate

Waiting for an update to the pg_control file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventControlFileSyncUpdate VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for an update to the pg_control file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE at src/common/controldata_utils.c:259 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:207. The instrumented operation is: Waiting for an update to the pg_control file to reach durable storage. PostgreSQL reports ControlFileSyncUpdate around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ControlFileSyncUpdate
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ControlFileSyncUpdate'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ControlFileSyncUpdate'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

13 - IO: ControlFileWrite

Waiting for a write to the pg_control file
PostgreSQL wait event dossier
ClassIO EventControlFileWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write to the pg_control file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_CONTROL_FILE_WRITE at src/backend/access/transam/xlog.c:4315 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:208. The instrumented operation is: Waiting for a write to the pg_control file. PostgreSQL reports ControlFileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ControlFileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ControlFileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ControlFileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

14 - IO: ControlFileWriteUpdate

Waiting for a write to update the pg_control file
PostgreSQL wait event dossier
ClassIO EventControlFileWriteUpdate VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write to update the pg_control file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE at src/common/controldata_utils.c:235 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:209. The instrumented operation is: Waiting for a write to update the pg_control file. PostgreSQL reports ControlFileWriteUpdate around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ControlFileWriteUpdate
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ControlFileWriteUpdate'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ControlFileWriteUpdate'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

15 - IO: CopyFileCopy

Waiting for a file copy operation
PostgreSQL wait event dossier
ClassIO EventCopyFileCopy VersionsPG 18 Evidence2 source location(s)

Official description

Waiting for a file copy operation

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_COPY_FILE_COPY at src/backend/storage/file/copydir.c:270 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:210. The instrumented operation is: Waiting for a file copy operation. PostgreSQL reports CopyFileCopy around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/CopyFileCopy
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'CopyFileCopy'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'CopyFileCopy'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

16 - IO: CopyFileRead

Waiting for a read during a file copy operation
PostgreSQL wait event dossier
ClassIO EventCopyFileRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read during a file copy operation

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_COPY_FILE_READ at src/backend/storage/file/copydir.c:195 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:211. The instrumented operation is: Waiting for a read during a file copy operation. PostgreSQL reports CopyFileRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/CopyFileRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'CopyFileRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'CopyFileRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

17 - IO: CopyFileWrite

Waiting for a write during a file copy operation
PostgreSQL wait event dossier
ClassIO EventCopyFileWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write during a file copy operation

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_COPY_FILE_WRITE at src/backend/storage/file/copydir.c:205 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:212. The instrumented operation is: Waiting for a write during a file copy operation. PostgreSQL reports CopyFileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/CopyFileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'CopyFileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'CopyFileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

18 - IO: DataFileExtend

Waiting for a relation data file to be extended
PostgreSQL wait event dossier
ClassIO EventDataFileExtend VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a relation data file to be extended

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_EXTEND at src/backend/storage/smgr/md.c:512 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:213. The instrumented operation is: Waiting for a relation data file to be extended. PostgreSQL reports DataFileExtend around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileExtend
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileExtend'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileExtend'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

19 - IO: DataFileFlush

Waiting for a relation data file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventDataFileFlush VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a relation data file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_FLUSH at src/backend/storage/smgr/md.c:1208 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:214. The instrumented operation is: Waiting for a relation data file to reach durable storage. PostgreSQL reports DataFileFlush around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileFlush
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileFlush'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileFlush'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

20 - IO: DataFileImmediateSync

Waiting for an immediate synchronization of a relation data file to durable storage
PostgreSQL wait event dossier
ClassIO EventDataFileImmediateSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for an immediate synchronization of a relation data file to durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_IMMEDIATE_SYNC at src/backend/storage/smgr/md.c:1466 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:215. The instrumented operation is: Waiting for an immediate synchronization of a relation data file to durable storage. PostgreSQL reports DataFileImmediateSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileImmediateSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileImmediateSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileImmediateSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

21 - IO: DataFilePrefetch

Waiting for an asynchronous prefetch from a relation data file
PostgreSQL wait event dossier
ClassIO EventDataFilePrefetch VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for an asynchronous prefetch from a relation data file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_PREFETCH at src/backend/storage/smgr/md.c:767 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:216. The instrumented operation is: Waiting for an asynchronous prefetch from a relation data file. PostgreSQL reports DataFilePrefetch around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFilePrefetch
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFilePrefetch'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFilePrefetch'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

22 - IO: DataFileRead

Waiting for a read from a relation data file
PostgreSQL wait event dossier
ClassIO EventDataFileRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read from a relation data file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_READ at src/backend/storage/aio/aio_io.c:127 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:217. The instrumented operation is: Waiting for a read from a relation data file. PostgreSQL reports DataFileRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

23 - IO: DataFileSync

Waiting for changes to a relation data file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventDataFileSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for changes to a relation data file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_SYNC at src/backend/storage/smgr/md.c:1526 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:218. The instrumented operation is: Waiting for changes to a relation data file to reach durable storage. PostgreSQL reports DataFileSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

24 - IO: DataFileTruncate

Waiting for a relation data file to be truncated
PostgreSQL wait event dossier
ClassIO EventDataFileTruncate VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a relation data file to be truncated

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_TRUNCATE at src/backend/storage/smgr/md.c:1329 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:219. The instrumented operation is: Waiting for a relation data file to be truncated. PostgreSQL reports DataFileTruncate around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileTruncate
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileTruncate'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileTruncate'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

25 - IO: DataFileWrite

Waiting for a write to a relation data file
PostgreSQL wait event dossier
ClassIO EventDataFileWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write to a relation data file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_DATA_FILE_WRITE at src/backend/storage/aio/aio_io.c:134 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:220. The instrumented operation is: Waiting for a write to a relation data file. PostgreSQL reports DataFileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DataFileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DataFileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DataFileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

26 - IO: DsmAllocate

Waiting for a dynamic shared memory segment to be allocated
PostgreSQL wait event dossier
ClassIO EventDsmAllocate VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a dynamic shared memory segment to be allocated

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/DSMAllocate (PG 16)

Trigger mechanism

WAIT_EVENT_DSM_ALLOCATE at src/backend/storage/ipc/dsm_impl.c:366 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:604. The instrumented operation is: Waiting for a dynamic shared memory segment to be allocated. PostgreSQL reports DsmAllocate around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DsmAllocate
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DsmAllocate'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DsmAllocate'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

27 - IO: DsmFillZeroWrite

Waiting to fill a dynamic shared memory backing file with zeroes
PostgreSQL wait event dossier
ClassIO EventDsmFillZeroWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting to fill a dynamic shared memory backing file with zeroes

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/DSMFillZeroWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_DSM_FILL_ZERO_WRITE at src/backend/storage/ipc/dsm_impl.c:891 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:607. The instrumented operation is: Waiting to fill a dynamic shared memory backing file with zeroes. PostgreSQL reports DsmFillZeroWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/DsmFillZeroWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'DsmFillZeroWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'DsmFillZeroWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

28 - IO: LockFileAddtodatadirRead

Waiting for a read while adding a line to the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileAddtodatadirRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read while adding a line to the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/LockFileAddToDataDirRead (PG 13-16)

Trigger mechanism

WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ at src/backend/utils/init/miscinit.c:1586 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:610. The instrumented operation is: Waiting for a read while adding a line to the data directory lock file. PostgreSQL reports LockFileAddtodatadirRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileAddtodatadirRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileAddtodatadirRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileAddtodatadirRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

29 - IO: LockFileAddtodatadirSync

Waiting for data to reach durable storage while adding a line to the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileAddtodatadirSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for data to reach durable storage while adding a line to the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/LockFileAddToDataDirSync (PG 13-16)

Trigger mechanism

WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC at src/backend/utils/init/miscinit.c:1663 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:613. The instrumented operation is: Waiting for data to reach durable storage while adding a line to the data directory lock file. PostgreSQL reports LockFileAddtodatadirSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileAddtodatadirSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileAddtodatadirSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileAddtodatadirSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

30 - IO: LockFileAddtodatadirWrite

Waiting for a write while adding a line to the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileAddtodatadirWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write while adding a line to the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/LockFileAddToDataDirWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE at src/backend/utils/init/miscinit.c:1648 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:616. The instrumented operation is: Waiting for a write while adding a line to the data directory lock file. PostgreSQL reports LockFileAddtodatadirWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileAddtodatadirWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileAddtodatadirWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileAddtodatadirWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

31 - IO: LockFileCreateRead

Waiting to read while creating the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileCreateRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting to read while creating the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOCK_FILE_CREATE_READ at src/backend/utils/init/miscinit.c:1302 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:226. The instrumented operation is: Waiting to read while creating the data directory lock file. PostgreSQL reports LockFileCreateRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileCreateRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileCreateRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileCreateRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

32 - IO: LockFileCreateSync

Waiting for data to reach durable storage while creating the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileCreateSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for data to reach durable storage while creating the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOCK_FILE_CREATE_SYNC at src/backend/utils/init/miscinit.c:1465 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:227. The instrumented operation is: Waiting for data to reach durable storage while creating the data directory lock file. PostgreSQL reports LockFileCreateSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileCreateSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileCreateSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileCreateSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

33 - IO: LockFileCreateWrite

Waiting for a write while creating the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileCreateWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write while creating the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOCK_FILE_CREATE_WRITE at src/backend/utils/init/miscinit.c:1450 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:228. The instrumented operation is: Waiting for a write while creating the data directory lock file. PostgreSQL reports LockFileCreateWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileCreateWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileCreateWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileCreateWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

34 - IO: LockFileRecheckdatadirRead

Waiting for a read during recheck of the data directory lock file
PostgreSQL wait event dossier
ClassIO EventLockFileRecheckdatadirRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read during recheck of the data directory lock file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/LockFileReCheckDataDirRead (PG 13-16)

Trigger mechanism

WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ at src/backend/utils/init/miscinit.c:1728 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:628. The instrumented operation is: Waiting for a read during recheck of the data directory lock file. PostgreSQL reports LockFileRecheckdatadirRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LockFileRecheckdatadirRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LockFileRecheckdatadirRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LockFileRecheckdatadirRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

35 - IO: LogicalChangesRead

Waiting for a read from a logical changes file.
PostgreSQL wait event dossier
ClassIO EventLogicalChangesRead VersionsPG 14 Evidence1 source location(s)

Official description

Waiting for a read from a logical changes file.

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

The catalog identity is present, but source audit found no live reporter in 14. Known active ranges: none. The definition location below is retained as negative evidence; this exact release cannot emit the event from a core code path. Evidence: pgsql-hackers confirmation.

Normal or trouble?

  • Normal: No live core occurrence is expected on the audited release.
  • Investigate: If telemetry shows it, verify the exact patch version, extension origin, and whether the sample is stale or came from a different server.

Diagnostic SQL

Sessions waiting on IO/LogicalChangesRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalChangesRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalChangesRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

36 - IO: LogicalChangesWrite

Waiting for a write to a logical changes file.
PostgreSQL wait event dossier
ClassIO EventLogicalChangesWrite VersionsPG 14 Evidence1 source location(s)

Official description

Waiting for a write to a logical changes file.

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

The catalog identity is present, but source audit found no live reporter in 14. Known active ranges: none. The definition location below is retained as negative evidence; this exact release cannot emit the event from a core code path. Evidence: pgsql-hackers confirmation.

Normal or trouble?

  • Normal: No live core occurrence is expected on the audited release.
  • Investigate: If telemetry shows it, verify the exact patch version, extension origin, and whether the sample is stale or came from a different server.

Diagnostic SQL

Sessions waiting on IO/LogicalChangesWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalChangesWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalChangesWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

37 - IO: LogicalRewriteCheckpointSync

Waiting for logical rewrite mappings to reach durable storage during a checkpoint
PostgreSQL wait event dossier
ClassIO EventLogicalRewriteCheckpointSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for logical rewrite mappings to reach durable storage during a checkpoint

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOGICAL_REWRITE_CHECKPOINT_SYNC at src/backend/access/heap/rewriteheap.c:1236 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:230. The instrumented operation is: Waiting for logical rewrite mappings to reach durable storage during a checkpoint. PostgreSQL reports LogicalRewriteCheckpointSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LogicalRewriteCheckpointSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalRewriteCheckpointSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalRewriteCheckpointSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

38 - IO: LogicalRewriteMappingSync

Waiting for mapping data to reach durable storage during a logical rewrite
PostgreSQL wait event dossier
ClassIO EventLogicalRewriteMappingSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for mapping data to reach durable storage during a logical rewrite

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOGICAL_REWRITE_MAPPING_SYNC at src/backend/access/heap/rewriteheap.c:1131 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:231. The instrumented operation is: Waiting for mapping data to reach durable storage during a logical rewrite. PostgreSQL reports LogicalRewriteMappingSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LogicalRewriteMappingSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalRewriteMappingSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalRewriteMappingSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

39 - IO: LogicalRewriteMappingWrite

Waiting for a write of mapping data during a logical rewrite
PostgreSQL wait event dossier
ClassIO EventLogicalRewriteMappingWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write of mapping data during a logical rewrite

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOGICAL_REWRITE_MAPPING_WRITE at src/backend/access/heap/rewriteheap.c:1114 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:232. The instrumented operation is: Waiting for a write of mapping data during a logical rewrite. PostgreSQL reports LogicalRewriteMappingWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LogicalRewriteMappingWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalRewriteMappingWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalRewriteMappingWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

40 - IO: LogicalRewriteSync

Waiting for logical rewrite mappings to reach durable storage
PostgreSQL wait event dossier
ClassIO EventLogicalRewriteSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for logical rewrite mappings to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOGICAL_REWRITE_SYNC at src/backend/access/heap/rewriteheap.c:922 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:233. The instrumented operation is: Waiting for logical rewrite mappings to reach durable storage. PostgreSQL reports LogicalRewriteSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LogicalRewriteSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalRewriteSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalRewriteSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

41 - IO: LogicalRewriteTruncate

Waiting for truncate of mapping data during a logical rewrite
PostgreSQL wait event dossier
ClassIO EventLogicalRewriteTruncate VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for truncate of mapping data during a logical rewrite

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOGICAL_REWRITE_TRUNCATE at src/backend/access/heap/rewriteheap.c:1100 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:234. The instrumented operation is: Waiting for truncate of mapping data during a logical rewrite. PostgreSQL reports LogicalRewriteTruncate around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LogicalRewriteTruncate
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalRewriteTruncate'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalRewriteTruncate'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

42 - IO: LogicalRewriteWrite

Waiting for a write of logical rewrite mappings
PostgreSQL wait event dossier
ClassIO EventLogicalRewriteWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write of logical rewrite mappings

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_LOGICAL_REWRITE_WRITE at src/backend/access/heap/rewriteheap.c:881 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:235. The instrumented operation is: Waiting for a write of logical rewrite mappings. PostgreSQL reports LogicalRewriteWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/LogicalRewriteWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalRewriteWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalRewriteWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

43 - IO: LogicalSubxactRead

Waiting for a read from a logical subxact file.
PostgreSQL wait event dossier
ClassIO EventLogicalSubxactRead VersionsPG 14 Evidence1 source location(s)

Official description

Waiting for a read from a logical subxact file.

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

The catalog identity is present, but source audit found no live reporter in 14. Known active ranges: none. The definition location below is retained as negative evidence; this exact release cannot emit the event from a core code path. Evidence: pgsql-hackers confirmation.

Normal or trouble?

  • Normal: No live core occurrence is expected on the audited release.
  • Investigate: If telemetry shows it, verify the exact patch version, extension origin, and whether the sample is stale or came from a different server.

Diagnostic SQL

Sessions waiting on IO/LogicalSubxactRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalSubxactRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalSubxactRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

44 - IO: LogicalSubxactWrite

Waiting for a write to a logical subxact file.
PostgreSQL wait event dossier
ClassIO EventLogicalSubxactWrite VersionsPG 14 Evidence1 source location(s)

Official description

Waiting for a write to a logical subxact file.

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

The catalog identity is present, but source audit found no live reporter in 14. Known active ranges: none. The definition location below is retained as negative evidence; this exact release cannot emit the event from a core code path. Evidence: pgsql-hackers confirmation.

Normal or trouble?

  • Normal: No live core occurrence is expected on the audited release.
  • Investigate: If telemetry shows it, verify the exact patch version, extension origin, and whether the sample is stale or came from a different server.

Diagnostic SQL

Sessions waiting on IO/LogicalSubxactWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'LogicalSubxactWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'LogicalSubxactWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

45 - IO: RelationMapRead

Waiting for a read of the relation map file
PostgreSQL wait event dossier
ClassIO EventRelationMapRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read of the relation map file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_RELATION_MAP_READ at src/backend/utils/cache/relmapper.c:822 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:236. The instrumented operation is: Waiting for a read of the relation map file. PostgreSQL reports RelationMapRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/RelationMapRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'RelationMapRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'RelationMapRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

46 - IO: RelationMapReplace

Waiting for durable replacement of a relation map file
PostgreSQL wait event dossier
ClassIO EventRelationMapReplace VersionsPG 16-18 Evidence2 source location(s)

Official description

Waiting for durable replacement of a relation map file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_RELATION_MAP_REPLACE at src/backend/utils/cache/relmapper.c:988 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:237. The instrumented operation is: Waiting for durable replacement of a relation map file. PostgreSQL reports RelationMapReplace around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/RelationMapReplace
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'RelationMapReplace'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'RelationMapReplace'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

47 - IO: RelationMapSync

Waiting for the relation map file to reach durable storage.
PostgreSQL wait event dossier
ClassIO EventRelationMapSync VersionsPG 13-15 Evidence2 source location(s)

Official description

Waiting for the relation map file to reach durable storage.

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_RELATION_MAP_SYNC at src/backend/utils/cache/relmapper.c:957 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:637. The instrumented operation is: Waiting for the relation map file to reach durable storage. PostgreSQL reports RelationMapSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/RelationMapSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'RelationMapSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'RelationMapSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

48 - IO: RelationMapWrite

Waiting for a write to the relation map file
PostgreSQL wait event dossier
ClassIO EventRelationMapWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write to the relation map file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_RELATION_MAP_WRITE at src/backend/utils/cache/relmapper.c:939 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:238. The instrumented operation is: Waiting for a write to the relation map file. PostgreSQL reports RelationMapWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/RelationMapWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'RelationMapWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'RelationMapWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

49 - IO: ReorderBufferRead

Waiting for a read during reorder buffer management
PostgreSQL wait event dossier
ClassIO EventReorderBufferRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read during reorder buffer management

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REORDER_BUFFER_READ at src/backend/replication/logical/reorderbuffer.c:4609 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:239. The instrumented operation is: Waiting for a read during reorder buffer management. PostgreSQL reports ReorderBufferRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReorderBufferRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReorderBufferRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReorderBufferRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

50 - IO: ReorderBufferWrite

Waiting for a write during reorder buffer management
PostgreSQL wait event dossier
ClassIO EventReorderBufferWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write during reorder buffer management

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REORDER_BUFFER_WRITE at src/backend/replication/logical/reorderbuffer.c:4265 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:240. The instrumented operation is: Waiting for a write during reorder buffer management. PostgreSQL reports ReorderBufferWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReorderBufferWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReorderBufferWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReorderBufferWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

51 - IO: ReorderLogicalMappingRead

Waiting for a read of a logical mapping during reorder buffer management
PostgreSQL wait event dossier
ClassIO EventReorderLogicalMappingRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read of a logical mapping during reorder buffer management

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REORDER_LOGICAL_MAPPING_READ at src/backend/replication/logical/reorderbuffer.c:5383 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:241. The instrumented operation is: Waiting for a read of a logical mapping during reorder buffer management. PostgreSQL reports ReorderLogicalMappingRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReorderLogicalMappingRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReorderLogicalMappingRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReorderLogicalMappingRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

52 - IO: ReplicationSlotRead

Waiting for a read from a replication slot control file
PostgreSQL wait event dossier
ClassIO EventReplicationSlotRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read from a replication slot control file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REPLICATION_SLOT_READ at src/backend/replication/slot.c:2540 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:242. The instrumented operation is: Waiting for a read from a replication slot control file. PostgreSQL reports ReplicationSlotRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReplicationSlotRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReplicationSlotRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReplicationSlotRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

53 - IO: ReplicationSlotRestoreSync

Waiting for a replication slot control file to reach durable storage while restoring it to memory
PostgreSQL wait event dossier
ClassIO EventReplicationSlotRestoreSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a replication slot control file to reach durable storage while restoring it to memory

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REPLICATION_SLOT_RESTORE_SYNC at src/backend/replication/slot.c:2526 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:243. The instrumented operation is: Waiting for a replication slot control file to reach durable storage while restoring it to memory. PostgreSQL reports ReplicationSlotRestoreSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReplicationSlotRestoreSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReplicationSlotRestoreSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReplicationSlotRestoreSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

54 - IO: ReplicationSlotSync

Waiting for a replication slot control file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventReplicationSlotSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a replication slot control file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REPLICATION_SLOT_SYNC at src/backend/replication/slot.c:2405 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:244. The instrumented operation is: Waiting for a replication slot control file to reach durable storage. PostgreSQL reports ReplicationSlotSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReplicationSlotSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReplicationSlotSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReplicationSlotSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

55 - IO: ReplicationSlotWrite

Waiting for a write to a replication slot control file
PostgreSQL wait event dossier
ClassIO EventReplicationSlotWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write to a replication slot control file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_REPLICATION_SLOT_WRITE at src/backend/replication/slot.c:2384 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:245. The instrumented operation is: Waiting for a write to a replication slot control file. PostgreSQL reports ReplicationSlotWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/ReplicationSlotWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'ReplicationSlotWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'ReplicationSlotWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

56 - IO: SlruFlushSync

Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown
PostgreSQL wait event dossier
ClassIO EventSlruFlushSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/SLRUFlushSync (PG 13-16)

Trigger mechanism

WAIT_EVENT_SLRU_FLUSH_SYNC at src/backend/access/transam/slru.c:1606 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:679. The instrumented operation is: Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown. PostgreSQL reports SlruFlushSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SlruFlushSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SlruFlushSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SlruFlushSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

57 - IO: SlruRead

Waiting for a read of an SLRU page
PostgreSQL wait event dossier
ClassIO EventSlruRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read of an SLRU page

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/SLRURead (PG 13-16)

Trigger mechanism

WAIT_EVENT_SLRU_READ at src/backend/access/transam/slru.c:721 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:682. The instrumented operation is: Waiting for a read of an SLRU page. PostgreSQL reports SlruRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SlruRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SlruRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SlruRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

58 - IO: SlruSync

Waiting for SLRU data to reach durable storage following a page write
PostgreSQL wait event dossier
ClassIO EventSlruSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for SLRU data to reach durable storage following a page write

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/SLRUSync (PG 13-16)

Trigger mechanism

WAIT_EVENT_SLRU_SYNC at src/backend/access/transam/slru.c:900 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:685. The instrumented operation is: Waiting for SLRU data to reach durable storage following a page write. PostgreSQL reports SlruSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SlruSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SlruSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SlruSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

59 - IO: SlruWrite

Waiting for a write of an SLRU page
PostgreSQL wait event dossier
ClassIO EventSlruWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write of an SLRU page

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/SLRUWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_SLRU_WRITE at src/backend/access/transam/slru.c:876 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:688. The instrumented operation is: Waiting for a write of an SLRU page. PostgreSQL reports SlruWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SlruWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SlruWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SlruWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

60 - IO: SnapbuildRead

Waiting for a read of a serialized historical catalog snapshot
PostgreSQL wait event dossier
ClassIO EventSnapbuildRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read of a serialized historical catalog snapshot

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_SNAPBUILD_READ at src/backend/replication/logical/snapbuild.c:1937 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:250. The instrumented operation is: Waiting for a read of a serialized historical catalog snapshot. PostgreSQL reports SnapbuildRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SnapbuildRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SnapbuildRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SnapbuildRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

61 - IO: SnapbuildSync

Waiting for a serialized historical catalog snapshot to reach durable storage
PostgreSQL wait event dossier
ClassIO EventSnapbuildSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a serialized historical catalog snapshot to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_SNAPBUILD_SYNC at src/backend/replication/logical/snapbuild.c:1680 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:251. The instrumented operation is: Waiting for a serialized historical catalog snapshot to reach durable storage. PostgreSQL reports SnapbuildSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SnapbuildSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SnapbuildSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SnapbuildSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

62 - IO: SnapbuildWrite

Waiting for a write of a serialized historical catalog snapshot
PostgreSQL wait event dossier
ClassIO EventSnapbuildWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write of a serialized historical catalog snapshot

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_SNAPBUILD_WRITE at src/backend/replication/logical/snapbuild.c:1654 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:252. The instrumented operation is: Waiting for a write of a serialized historical catalog snapshot. PostgreSQL reports SnapbuildWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/SnapbuildWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'SnapbuildWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'SnapbuildWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

63 - IO: TimelineHistoryFileSync

Waiting for a timeline history file received via streaming replication to reach durable storage
PostgreSQL wait event dossier
ClassIO EventTimelineHistoryFileSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a timeline history file received via streaming replication to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TIMELINE_HISTORY_FILE_SYNC at src/backend/access/transam/timeline.c:502 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:253. The instrumented operation is: Waiting for a timeline history file received via streaming replication to reach durable storage. PostgreSQL reports TimelineHistoryFileSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TimelineHistoryFileSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TimelineHistoryFileSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TimelineHistoryFileSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

64 - IO: TimelineHistoryFileWrite

Waiting for a write of a timeline history file received via streaming replication
PostgreSQL wait event dossier
ClassIO EventTimelineHistoryFileWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write of a timeline history file received via streaming replication

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TIMELINE_HISTORY_FILE_WRITE at src/backend/access/transam/timeline.c:484 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:254. The instrumented operation is: Waiting for a write of a timeline history file received via streaming replication. PostgreSQL reports TimelineHistoryFileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TimelineHistoryFileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TimelineHistoryFileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TimelineHistoryFileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

65 - IO: TimelineHistoryRead

Waiting for a read of a timeline history file
PostgreSQL wait event dossier
ClassIO EventTimelineHistoryRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read of a timeline history file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TIMELINE_HISTORY_READ at src/backend/access/transam/timeline.c:135 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:255. The instrumented operation is: Waiting for a read of a timeline history file. PostgreSQL reports TimelineHistoryRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TimelineHistoryRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TimelineHistoryRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TimelineHistoryRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

66 - IO: TimelineHistorySync

Waiting for a newly created timeline history file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventTimelineHistorySync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a newly created timeline history file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TIMELINE_HISTORY_SYNC at src/backend/access/transam/timeline.c:428 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:256. The instrumented operation is: Waiting for a newly created timeline history file to reach durable storage. PostgreSQL reports TimelineHistorySync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TimelineHistorySync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TimelineHistorySync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TimelineHistorySync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

67 - IO: TimelineHistoryWrite

Waiting for a write of a newly created timeline history file
PostgreSQL wait event dossier
ClassIO EventTimelineHistoryWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write of a newly created timeline history file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TIMELINE_HISTORY_WRITE at src/backend/access/transam/timeline.c:366 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:257. The instrumented operation is: Waiting for a write of a newly created timeline history file. PostgreSQL reports TimelineHistoryWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TimelineHistoryWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TimelineHistoryWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TimelineHistoryWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

68 - IO: TwophaseFileRead

Waiting for a read of a two phase state file
PostgreSQL wait event dossier
ClassIO EventTwophaseFileRead VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a read of a two phase state file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TWOPHASE_FILE_READ at src/backend/access/transam/twophase.c:1347 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:258. The instrumented operation is: Waiting for a read of a two phase state file. PostgreSQL reports TwophaseFileRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TwophaseFileRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TwophaseFileRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TwophaseFileRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

69 - IO: TwophaseFileSync

Waiting for a two phase state file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventTwophaseFileSync VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a two phase state file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TWOPHASE_FILE_SYNC at src/backend/access/transam/twophase.c:1774 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:259. The instrumented operation is: Waiting for a two phase state file to reach durable storage. PostgreSQL reports TwophaseFileSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TwophaseFileSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TwophaseFileSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TwophaseFileSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

70 - IO: TwophaseFileWrite

Waiting for a write of a two phase state file
PostgreSQL wait event dossier
ClassIO EventTwophaseFileWrite VersionsPG 13-18 Evidence2 source location(s)

Official description

Waiting for a write of a two phase state file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_TWOPHASE_FILE_WRITE at src/backend/access/transam/twophase.c:1749 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:260. The instrumented operation is: Waiting for a write of a two phase state file. PostgreSQL reports TwophaseFileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/TwophaseFileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'TwophaseFileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'TwophaseFileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

71 - IO: VersionFileSync

Waiting for the version file to reach durable storage while creating a database
PostgreSQL wait event dossier
ClassIO EventVersionFileSync VersionsPG 15-18 Evidence2 source location(s)

Official description

Waiting for the version file to reach durable storage while creating a database

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_VERSION_FILE_SYNC at src/backend/commands/dbcommands.c:511 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:261. The instrumented operation is: Waiting for the version file to reach durable storage while creating a database. PostgreSQL reports VersionFileSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/VersionFileSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'VersionFileSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'VersionFileSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

72 - IO: VersionFileWrite

Waiting for the version file to be written while creating a database
PostgreSQL wait event dossier
ClassIO EventVersionFileWrite VersionsPG 15-18 Evidence2 source location(s)

Official description

Waiting for the version file to be written while creating a database

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_VERSION_FILE_WRITE at src/backend/commands/dbcommands.c:498 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:262. The instrumented operation is: Waiting for the version file to be written while creating a database. PostgreSQL reports VersionFileWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/VersionFileWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'VersionFileWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'VersionFileWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

73 - IO: WalBootstrapSync

Waiting for WAL to reach durable storage during bootstrapping
PostgreSQL wait event dossier
ClassIO EventWalBootstrapSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for WAL to reach durable storage during bootstrapping

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALBootstrapSync (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_BOOTSTRAP_SYNC at src/backend/access/transam/xlog.c:4776 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:733. The instrumented operation is: Waiting for WAL to reach durable storage during bootstrapping. PostgreSQL reports WalBootstrapSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalBootstrapSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalBootstrapSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalBootstrapSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

74 - IO: WalBootstrapWrite

Waiting for a write of a WAL page during bootstrapping
PostgreSQL wait event dossier
ClassIO EventWalBootstrapWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write of a WAL page during bootstrapping

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALBootstrapWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_BOOTSTRAP_WRITE at src/backend/access/transam/xlog.c:4764 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:736. The instrumented operation is: Waiting for a write of a WAL page during bootstrapping. PostgreSQL reports WalBootstrapWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalBootstrapWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalBootstrapWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalBootstrapWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

75 - IO: WalCopyRead

Waiting for a read when creating a new WAL segment by copying an existing one
PostgreSQL wait event dossier
ClassIO EventWalCopyRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read when creating a new WAL segment by copying an existing one

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALCopyRead (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_COPY_READ at src/backend/access/transam/xlog.c:3190 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:739. The instrumented operation is: Waiting for a read when creating a new WAL segment by copying an existing one. PostgreSQL reports WalCopyRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalCopyRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalCopyRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalCopyRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

76 - IO: WalCopySync

Waiting for a new WAL segment created by copying an existing one to reach durable storage
PostgreSQL wait event dossier
ClassIO EventWalCopySync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a new WAL segment created by copying an existing one to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALCopySync (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_COPY_SYNC at src/backend/access/transam/xlog.c:3227 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:742. The instrumented operation is: Waiting for a new WAL segment created by copying an existing one to reach durable storage. PostgreSQL reports WalCopySync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalCopySync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalCopySync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalCopySync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

77 - IO: WalCopyWrite

Waiting for a write when creating a new WAL segment by copying an existing one
PostgreSQL wait event dossier
ClassIO EventWalCopyWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write when creating a new WAL segment by copying an existing one

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALCopyWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_COPY_WRITE at src/backend/access/transam/xlog.c:3208 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:745. The instrumented operation is: Waiting for a write when creating a new WAL segment by copying an existing one. PostgreSQL reports WalCopyWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalCopyWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalCopyWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalCopyWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

78 - IO: WalInitSync

Waiting for a newly initialized WAL file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventWalInitSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a newly initialized WAL file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALInitSync (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_INIT_SYNC at src/backend/access/transam/xlog.c:3028 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:748. The instrumented operation is: Waiting for a newly initialized WAL file to reach durable storage. PostgreSQL reports WalInitSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalInitSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalInitSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalInitSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

79 - IO: WalInitWrite

Waiting for a write while initializing a new WAL file
PostgreSQL wait event dossier
ClassIO EventWalInitWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write while initializing a new WAL file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALInitWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_INIT_WRITE at src/backend/access/transam/xlog.c:2977 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:751. The instrumented operation is: Waiting for a write while initializing a new WAL file. PostgreSQL reports WalInitWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalInitWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalInitWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalInitWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

80 - IO: WalRead

Waiting for a read from a WAL file
PostgreSQL wait event dossier
ClassIO EventWalRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read from a WAL file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALRead (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_READ at src/backend/access/transam/xlogreader.c:1570 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:754. The instrumented operation is: Waiting for a read from a WAL file. PostgreSQL reports WalRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

81 - IO: WalSummaryRead

Waiting for a read from a WAL summary file
PostgreSQL wait event dossier
ClassIO EventWalSummaryRead VersionsPG 17-18 Evidence2 source location(s)

Official description

Waiting for a read from a WAL summary file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_WAL_SUMMARY_READ at src/backend/backup/walsummary.c:279 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:272. The instrumented operation is: Waiting for a read from a WAL summary file. PostgreSQL reports WalSummaryRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalSummaryRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalSummaryRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalSummaryRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

82 - IO: WalSummaryWrite

Waiting for a write to a WAL summary file
PostgreSQL wait event dossier
ClassIO EventWalSummaryWrite VersionsPG 17-18 Evidence2 source location(s)

Official description

Waiting for a write to a WAL summary file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Trigger mechanism

WAIT_EVENT_WAL_SUMMARY_WRITE at src/backend/backup/walsummary.c:300 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event_names.txt:273. The instrumented operation is: Waiting for a write to a WAL summary file. PostgreSQL reports WalSummaryWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalSummaryWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalSummaryWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalSummaryWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

83 - IO: WalSync

Waiting for a WAL file to reach durable storage
PostgreSQL wait event dossier
ClassIO EventWalSync VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a WAL file to reach durable storage

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALSync (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_SYNC at src/backend/access/transam/xlog.c:8303 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:757. The instrumented operation is: Waiting for a WAL file to reach durable storage. PostgreSQL reports WalSync around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalSync
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalSync'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalSync'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

84 - IO: WalSyncMethodAssign

Waiting for data to reach durable storage while assigning a new WAL sync method
PostgreSQL wait event dossier
ClassIO EventWalSyncMethodAssign VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for data to reach durable storage while assigning a new WAL sync method

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALSyncMethodAssign (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN at src/backend/access/transam/xlog.c:8251 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:760. The instrumented operation is: Waiting for data to reach durable storage while assigning a new WAL sync method. PostgreSQL reports WalSyncMethodAssign around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalSyncMethodAssign
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalSyncMethodAssign'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalSyncMethodAssign'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

85 - IO: WalWrite

Waiting for a write to a WAL file
PostgreSQL wait event dossier
ClassIO EventWalWrite VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a write to a WAL file

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALWrite (PG 13-16)

Trigger mechanism

WAIT_EVENT_WAL_WRITE at src/backend/access/transam/xlog.c:2200 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:763. The instrumented operation is: Waiting for a write to a WAL file. PostgreSQL reports WalWrite around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalWrite
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalWrite'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalWrite'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence

86 - IO: WalsenderTimelineHistoryRead

Waiting for a read from a timeline history file during a walsender timeline command
PostgreSQL wait event dossier
ClassIO EventWalsenderTimelineHistoryRead VersionsPG 17-18 Evidence4 source location(s)

Official description

Waiting for a read from a timeline history file during a walsender timeline command

PG 13 PG 14 PG 15 PG 16 PG 17 PG 18

Earlier names: IO/WALSenderTimelineHistoryRead (PG 13-16)

Trigger mechanism

WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ at src/backend/replication/walsender.c:654 is the grep-verified reporting path. The public identity/resource is mapped at src/backend/utils/activity/wait_event.c:730. The instrumented operation is: Waiting for a read from a timeline history file during a walsender timeline command. PostgreSQL reports WalsenderTimelineHistoryRead around the instrumented file or asynchronous-I/O operation named by this event. The backend resumes after the kernel, storage stack, or I/O worker completes that step.

Normal or trouble?

  • Normal: The wait is normal when the workload is expected to perform this read, write, sync, allocation, or completion operation at the observed rate.
  • Investigate: Investigate when it persists with foreground latency, many concurrent waiters, storage tail latency, throttling, or errors.

Diagnostic SQL

Sessions waiting on IO/WalsenderTimelineHistoryRead
SELECT pid, backend_type, usename, datname, application_name,
       state, now() - query_start AS query_age,
       now() - xact_start AS xact_age,
       wait_event_type, wait_event,
       pg_blocking_pids(pid) AS blocking_pids,
       left(query, 160) AS query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
  AND wait_event = 'WalsenderTimelineHistoryRead'
ORDER BY query_age DESC NULLS LAST;
Current IO cohort
SELECT wait_event, count(*) AS waiting_sessions,
       count(*) FILTER (WHERE state = 'active') AS active_waiters,
       max(now() - query_start) AS oldest_query
FROM pg_stat_activity
WHERE wait_event_type = 'IO'
GROUP BY wait_event
ORDER BY waiting_sessions DESC, wait_event;
Lock and relation context for these sessions
SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,
       d.datname, n.nspname, c.relname,
       l.page, l.tuple, l.virtualxid, l.transactionid,
       l.classid, l.objid, l.objsubid
FROM pg_stat_activity AS a
LEFT JOIN pg_locks AS l ON l.pid = a.pid
LEFT JOIN pg_database AS d ON d.oid = l.database
LEFT JOIN pg_class AS c
  ON c.oid = l.relation
 AND l.database = (
       SELECT oid FROM pg_database WHERE datname = current_database()
     )
LEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace
WHERE a.wait_event_type = 'IO'
  AND a.wait_event = 'WalsenderTimelineHistoryRead'
ORDER BY a.pid, l.granted, l.locktype, l.mode;

Response

  1. Confirm the workload phase should touch this file class.
  2. Correlate with pg_stat_io where available and per-device latency.
  3. Fix the access path, burst shape, or affected storage tier before tuning unrelated memory settings.

Source evidence