Skip to content

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.

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

Waiting for a read during a file copy operation

Waiting for a relation data file to reach durable storage

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

Waiting for an asynchronous prefetch from a relation data file

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

Waiting for a dynamic shared memory segment to be allocated

Waiting to fill a dynamic shared memory backing file with zeroes

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

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

Waiting for the relation map file to reach durable storage.

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

Waiting for a read of an SLRU page

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

Waiting for a write of an SLRU page

Waiting for a read of a serialized historical catalog snapshot

Waiting for a serialized historical catalog snapshot to reach durable storage

Waiting for a write of a serialized historical catalog snapshot

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

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

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

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

Waiting for WAL to reach durable storage during bootstrapping

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

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

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

Waiting for a newly initialized WAL file to reach durable storage

Waiting for a write while initializing a new WAL file

Waiting for a read from a WAL file

Waiting for a WAL file to reach durable storage

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

Waiting for a write to a WAL file