IT lexicon Database WAL (Write-Ahead Log)

WAL (Write-Ahead Log)

Database På svenska → Updated: 2026-05-28

Write-Ahead Logging — the database writes changes to a sequential log BEFORE applying them to the data files. Guarantees durability (the D in ACID): after a crash the log is replayed to restore committed transactions. The foundation for replication and point-in-time recovery.

Principle: a sequential log write is much faster than random writes to the data files; the log is the truth, the data files are updated lazily (at a checkpoint). On crash: redo from the latest checkpoint. PostgreSQL WAL also drives: streaming replication (send WAL to replicas), logical replication (decode WAL into row changes), PITR (archive WAL + a base backup). The term is generic: MySQL/InnoDB calls it the "redo log", SQLite has a WAL mode. WAL bloat: if a replica or replication slot hangs, WAL can accumulate and fill the disk — a common operational incident.

← Back to the lexicon