Why it matters

WAL configuration affects durability, performance, and recoverability. Getting it right is core DB ops.

Advertisement

The architecture

Append-only file. Every mutation (insert, update, delete) generates WAL records before data pages are modified.

Sync policy: fsync per commit (durable), periodic (fast, some loss possible), off (fast, unsafe).

WAL flowWrite to WALbefore data filesfsyncdurability boundaryData files updatedasyncWAL enables PITR: restore backup, replay WAL to point in time
WAL role in write path.
Advertisement

How it works end to end

Checkpoint: periodically write dirty pages to data files. After checkpoint, WAL up to that point can be discarded.

PITR: apply WAL from base backup to target time.

Replication: stream WAL to replicas.