DataFileWrite

DataFileWrite is a PostgreSQL wait event that occurs when a backend process is waiting for a write operation to complete on a data file (e.g., heap or index files).
This typically happens during operations that modify table or index data, such as INSERT, UPDATE, DELETE, or VACUUM, when the system needs to flush dirty pages from shared buffers to disk.
This event is typically associated with the Checkpointer, the Background Writer, or a User Backend that is forced to perform a "direct" write.

When to Investigate

If DataFileWrite is a top wait event, it almost always points to storage throughput limits or aggressive writing.
Monitor the system's I/O performance metrics, such as disk latency and throughput, to identify potential bottlenecks.

What to Do

  1. Tune the bgwriter and Checkpointer related parameters
  2. Consider using faster storage solutions (e.g., SSDs) if disk I/O is a bottleneck