WALWrite

The WALWrite event occurs when a backend process is waiting for the PostgreSQL WAL buffers to be written out to the operating system's write cache.
A backend waiting on WALWrite (LWLock) isn't necessarily doing I/O itself — it's waiting for another backend's write/flush to finish, because only one backend can hold WALWriteLock at a time.
High waits here indicate lock contention on the WAL write path

The Difference Between WALWrite and WALSync

WALWrite: Waiting for the data to be moved from PostgreSQL's internal buffers to the OS kernel buffer.
WALSync: Waiting for the OS to move the data to be from the OS kernel buffer to the physical disk.

Common Causes of High WALWrite Wait Times

When WALWrite becomes a bottleneck, it is usually due to one of the following factors:

Additional troubleshooting

You should also check your system-level I/O metrics (using tools like iostat or iotop) to see if the disk write latency is spiking.

Strategies for Optimization