WALSync

WALSync is a PostgreSQL wait event that occurs when a process is waiting for WAL (Write-Ahead Logging) records to be synchronized (flushed) to durable storage.
This typically happens during transaction commit when synchronous_commit is enabled (which is the default), ensuring that WAL data is safely written to disk before the transaction is considered complete.
The wait reflects time spent waiting for the operating system or storage hardware to confirm that WAL buffers have been physically written, and it falls under the IO wait event category.

How it Works

  1. Write: The process writes WAL data from the memory buffer to the OS file system cache.
  2. Sync: The process issues an fsync() system call (or equivalent) to force the OS to move that data from the volatile cache to the physical disk platter or SSD.
  3. The Wait: While the hardware is busy "syncing" that data, the PostgreSQL process enters the WALSync state.

When does it appear?

Impact on Performance