← all glossary terms

WAL (Write-Ahead Log)

A durability technique: every change goes to an append-only log first, so it survives a crash before reaching the main data file.

A Write-Ahead Log (WAL) is a durability technique used by almost every modern database. Every change is appended to a sequential, fsync'd log file before being applied to the main data files. If the process or host crashes between the log write and the data-file flush, the database can replay the WAL on restart and recover the committed-but-unflushed changes. The WAL is also the substrate for streaming replication (one server tails another's WAL), point-in-time recovery, and physical backups: a base backup plus the WAL since that backup is enough to restore to any moment in between.

In a self-hosting context

For self-hosters, the WAL is what makes a "pg_dump every 24 hours" backup policy survivable: pair the dump with archived WAL segments and the worst-case data loss shrinks from a day to seconds. Mattermost, Nextcloud, Gitea, and any other Postgres-backed self-host replacement inherit this property automatically — your job is just to ship the WAL archive somewhere safe (typically an S3-compatible bucket via MinIO or Garage). See RPO vs RTO for the framing.

All 30 terms