EVOPEDIA

← all systems · see it in The System

Write-ahead logging

boundaryInside: the log (records with sequence numbers, threaded per transaction, in a volatile buffer and on stable storage), the write-ahead rule that orders log writes before page writes and before commit is acknowledged, the force (flush) that makes records stable, group commit, checkpoints, and the restart and media recovery that read the log back. Outside: the database pages and files whose changes are logged, the operating system's page cache and the devices beneath it (which may acknowledge writes they have not made), the applications and people who rely on committed work, replicas that receive the log, and attackers or investigators who read it.
nested levelA technique and the structure it keeps (rung 12): built from log records, the log buffer, stable storage and the recovery manager; part of a database's transaction machinery and of journaling file systems; carried on computer hardware and the operating system's write path; reused in replicated state machines and, at the application level, in event sourcing.
scaletechnological

From the walk

For about 20 years PostgreSQL trusted a second try: when Linux reported that saving data to disk had failed, PostgreSQL asked again, and the second request said 'done' because the system had already marked the unsaved pages as clean. PostgreSQL then threw away the log it would have needed to recover, losing data; the fix was to crash on purpose and rebuild from the log instead (src:rebello-2020-fsync).

Definition. In computer science, write-ahead logging (WAL) is a family of techniques for providing atomicity and durability in database systems: a system records what it is about to change in an append-only log on stable storage before the change reaches its home location, and after a crash reads the log back to rebuild its state. Walked as both the practice (the rule, the recovery methods, the people and programs that keep it) and the structure it works on (the log itself: records ordered by log sequence numbers on stable storage). Definition drawn from the encyclopedia entry (Wikipedia, CC BY-SA).

On this page: Properties 2 · Measures 30 · Open contentions 3 · Cross-scale patterns 21 · Valence partners 14 · Partners and parts 63 · Notes 4 · Layers 54 · Sources 37

Properties published scienceour proposal

Sourced fields, and our own readings.

born at1978 (the principle named, Gray 1978, as cited)
born precision±10 years (contested: C-4628)

Measures (30) published science

checkpoint interval (Sprite LFS)30 s
SQLite automatic checkpoint threshold1000 pages of WAL
ext3 checkpoint point in a 50 MB journal25 MB written
share of disk bandwidth for new data (Sprite LFS)65-75 % (rest to cleaning)
utilisation threshold of cleaned segments to beat Unix FFS< 0.8 (< 0.5 to beat an improved FFS) fraction live
write cost of cleaning (LFS model)2/(1-u) multiple of ideal write time, u = fraction live in segments cleaned
data journaling write amplification (ext3 data mode)2 writes per data block (journal, then home)
transaction failure rate (1983)10-100 per minute
share of transactions that abort3 %
system failure frequency (assumed, 1983)several per week
target restart recovery time (1983)a few minutes
media failure frequency (1983)1-2 per year
media recovery time (1983)about 1 hour
operator errorsabout 1 per year
SSDs misbehaving under power fault13 of 15 devices
power-fault cycles to device death (worst SSD)136 cycles (another lost a third of its blocks after 8)
crash vulnerabilities found in 11 applications60 vulnerabilities
years PostgreSQL used fsync incorrectly20 years
log flush share of commit latency (group commit, LeanStore)about 8 %
4 KB random write latency, enterprise NVMe SSD11 µs
90th-percentile commit latency, autonomous commit (YCSB)175 µs
log insert throughput, Aether (single socket)over 1.8 GB/s
servers tolerated failing in a five-server Raft cluster2 servers
PostgreSQL page write unit8192 bytes = 16 sectors
event-sourced systems characterised19 systems, 25 engineers count
confidence of schema inference from one WAL write size (some sizes)100 %
BigFoot throughput cost (concurrent workloads, small segments)up to 7 % decrease
worst recovery recorded in production (one long transaction, SQL Server)12 hours
recovery time with constant time recovery (Azure SQL, production)under 3 min for 99.999% of recovery cases
write-behind logging gains on NVM1.3x throughput; recovery > 100x faster; storage 1.5x smaller ratio

Open contentions (3) open contention

Where sources or readings disagree. Both stay on the map.

Cross-scale patterns seen here (21) our proposal

Shapes that recur when the same kind of problem is solved at different scales, and how each shows in Write-ahead logging. Each links to every other system that shows it.

Valence: what it trades, and with whom (14) published science

Each exchange with a neighbour, read from both sides: who gains, who pays, and what carries it.

Partners and parts published science

Built from / builds (10)

Sits inside / holds (3)

expressed by (18)

floor filled by (22)

represents (1)

Kinds (7)

wired (2)

Notes published science

Layers

The ways it takes in its world, where they meet, and how it acts back, each from L1 (where it meets the world) up.

the boardroom (shared floors)

  1. L4: The write-ahead rule and commit: undo information logged before a page goes home, redo information forced before commit is acknowledged, page-LSNs to enforce it, group commit to share the force
  2. L5: Checkpoints and recovery: checkpoints, restart (analysis, redo by repeating history, undo with compensation records), media recovery from image copy and archive log, torn-page repair
  3. L6: The guarantees: atomicity and durability, restartable undo and redo, committed entries durable (on a majority, for a replicated log)
  4. L7: The services and people that rely on committed work: databases, file systems, replicated services, event-sourced applications, and users who see a booking stay booked

way in: Changes and commit requests from transactions

  1. L1: The program's requests: begin, the updates, commit or abort
  2. L2: The update applied to the page in the volatile buffer pool
  3. L3: A log record built and placed in the volatile log buffer, given its LSN

way in: Completion signals from the write path (fsync returns, device flush completions)

  1. L1: The media and their caches: platters, flash and the write-back caches in controllers and drives
  2. L2: The device's answer to a flush, which some devices give without having made the write durable
  3. L3: The operating system's fsync and its return code

way in: Log entries from a leader (a replicated log)

  1. L1: Messages between servers, subject to delay, partition, loss, duplication and reordering
  2. L2: Entries received and written to stable storage before the server answers
  3. L3: The consistency check: matching index and term mean matching logs up to there

way in: Log space and checkpoint thresholds (the log's own fullness)

  1. L1: The journal or WAL file as a circular buffer on storage
  2. L2: The log's size counted against a threshold
  3. L3: Readers' end marks that the checkpointer must not pass
  4. L4: The writer checks the checkpointer's progress and rewinds the WAL when all of it is home and unused

way in: Media failure: the archive copy and the archive log

  1. L1: A device whose contents are lost
  2. L2: The archive copy (image copy): an older state kept elsewhere
  3. L3: The archive log, read in sequence

way in: Settings made by administrators and designers (sync level, journaling mode, write caches)

  1. L1: The administrator's responsibility for the storage beneath
  2. L2: A file system's journaling mode chosen at mount time
  3. L3: A database's synchronous level: sync the log on every commit or not

way in: The restart after a crash: the log read back

  1. L1: Loss of power or a crash empties volatile memory
  2. L2: The master record at a well-known place points to the last complete checkpoint
  3. L3: The log read back: analysis from the begin-chkpt record the master record points to; redo from the RedoLSN (the oldest dirty page's RecLSN, which can lie before the checkpoint); undo back to the oldest loser's first record. In Sprite LFS, roll-forward reads only the log after the last checkpoint.
  4. L4: Analysis: which pages were dirty and which transactions were losers at the crash

way in: Torn or garbage data read back from storage

  1. L1: A page write cut partway by power loss: some sectors written, some not
  2. L2: A CRC-32C on every WAL record, checked during recovery and replication
  3. L3: Full page images in the WAL to restore a torn page

way out: Checkpoint, ARIES sense: a fuzzy checkpoint recorded in the log, no data pages written

  1. L3: the begin-chkpt LSN stored in the master record at a well-known place
  2. L5: begin-chkpt record, then an end-chkpt record holding the transaction table and the dirty-pages table, taken while updates go on

way out: Checkpoint, file-system and SQLite sense: logged blocks or frames copied back to their home locations, log space reclaimed

  1. L1: Pages written in place at their home locations
  2. L3: The log rewound or truncated so it does not grow without bound
  3. L5: Checkpointing writes journaled blocks to their fixed locations

way out: Commit acknowledged to the program and the user

  1. L1: The reply the user sees: the seat is booked
  2. L4: Commit marked and acknowledged only after the log records are durable

way out: Forcing the log to stable storage

  1. L1: Records on several non-volatile devices with independent failure modes
  2. L2: fsync and device flushes, with barriers at chosen points in a journal
  3. L4: The log forced up to a commit record's LSN (or a dirty page's LSN)

way out: Restart writes: redo and undo applied to pages, rollbacks logged

  1. L1: Dirty pages written to nonvolatile storage, still under the WAL rule
  2. L3: Compensation log records written for each undone update, chained so repeated restarts stay bounded
  3. L5: The redo pass repeats history; the undo pass rolls back losers

way out: The log shipped to replicas and followers

  1. L1: Entries sent to every server so every log holds the same commands in the same order
  2. L6: An entry is committed once replicated on a majority

way out: Write sizes visible to whoever holds the storage (unintended output)

  1. L1: Storage that may be compromised apart from the database
  2. L2: Encrypted WAL writes whose sizes follow what was written

write-ahead logging as database and storage researchers describe it: power, media and device caches at the bottom, the write path and its acknowledgements, log records with sequence numbers, the write-ahead rule and commit, checkpoints and restart recovery, the guarantees of atomicity and durability, up to the databases, file systems, replicated services and people that rely on committed work (reader's view)

  1. L1: Stable storage and what threatens it: disks, flash and battery- or capacitor-backed caches; power loss and crashes that empty volatile memory; the home locations where pages are updated in place
  2. L2: The write path and its acknowledgements: the operating system's page cache, fsync and its return code, device write caches, flush commands and barriers; the only signal that a write is durable
  3. L3: The log: records (update with redo and undo, compensation, commit, abort, checkpoint) with monotonically increasing log sequence numbers, threaded per transaction, appended to a volatile log buffer and forced to stable storage in sequence
  4. L4: The write-ahead rule and commit: undo information on the log before a page goes home; redo information forced before commit is acknowledged; page-LSNs let the buffer manager enforce it; group commit forces many commits at once
  5. L5: Checkpoints and recovery: checkpoints bound the log restart must read and let space be reclaimed; restart runs analysis, redo (repeating history) and undo (with compensation records); media recovery replays the archive log onto an image copy
  6. L6: The guarantees: atomicity and durability (ACID), restartable undo and redo, committed entries durable (in a replicated log, on a majority); what the system promises its users and what a recovery log must hold to keep the promise
  7. L7: What relies on committed work: databases (Db2, SQL Server, PostgreSQL, SQLite), journaling file systems, replicated services (Raft clusters), event-sourced applications, and the programmers and people who use their results without thinking about failures

Sources (37) published science

Write-ahead logging (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01)
Haerder T, Reuter A (1983) Principles of transaction-oriented database recovery. ACM Computing Surveys 15(4):287-317. doi:10.1145/289.291 (sections read: 1 transactions and failures, 2.2 storage hierarchy, 3.1-3.2 crash recovery and log information, 3.3-3.4 propagation strategies, checkpoints and implementation techniques incl. figure 13's classification scheme, 4 archive recovery; section 3 re-read in step 3) (behind its links)
Mohan C, Haderle D, Lindsay B, Pirahesh H, Schwarz P (1992) ARIES: a transaction recovery method supporting fine-granularity locking and partial rollbacks using write-ahead logging. ACM TODS 17(1):94-162. doi:10.1145/128765.128770 (sections read: abstract, 1 introduction incl. WAL protocol and buffer policies, 2 goals, 4.1-4.2 data structures, 5.4 checkpoints, 6 restart processing passes, 8 media recovery intro) (behind its links)
Journaling file system (Wikipedia, WME snapshot 2026-12-01) (behind its links)
Rosenblum M, Ousterhout JK (1992) The design and implementation of a log-structured file system. ACM TOCS 10(1):26-52. doi:10.1145/146941.146943 (sections read: abstract, 1, 2, 3 incl. 3.4 write cost, 4 crash recovery) (behind its links)
Ongaro D, Ousterhout J (2014) In search of an understandable consensus algorithm. USENIX ATC '14 (open access; sections read: 2 replicated state machines, 5 the Raft algorithm figures 2-3, 5.3 log replication, 5.4 safety) (behind its links)
Overeem M, Spoor M, Jansen S, Brinkkemper S (2021) An empirical characterization of event sourced systems and their schema evolution: lessons from industry. J. Systems and Software; arXiv:2104.01146 (sections read: abstract, 1 introduction, 2 method, 3 background and related areas, the challenges on projections and privacy) (behind its links)
SQLite Write-Ahead Logging documentation (sections read: 1 overview, 2 how WAL works, 2.1 checkpointing, 2.2 concurrency, 2.3 performance) (behind its links)
Dong S, Kryczka A, Jin Y, Stumm M (2021) RocksDB: evolution of development priorities in a key-value store serving large-scale applications. ACM TOS 17(4). doi:10.1145/3483840 (sections read: 1 introduction, 2 background: writes, MemTable, WAL, compaction) (behind its links)
Prabhakaran V, Arpaci-Dusseau AC, Arpaci-Dusseau RH (2005) Analysis and evolution of journaling file systems. USENIX ATC '05 (open access; sections read: 1 introduction, 2 ext3 background (modes, transactions, journal structure, checkpointing), 3.1-3.2 ext3 analysis, summary) (behind its links)
Gray J (1981) The Transaction Concept: Virtues and Limitations. Tandem Technical Report TR 81.3 (VLDB 1981) (behind its links)
Zheng M, Tucek J, Qin F, Lillibridge M (2013) Understanding the robustness of SSDs under power fault. USENIX FAST '13 (open access; sections read: 1 introduction, 2 background, 3 failure types and record format, 4 setup, 5.1 overall results, tables 1-5) (behind its links)
Pillai TS, Chidambaram V, Alagappan R, Al-Kiswany S, Arpaci-Dusseau AC, Arpaci-Dusseau RH (2014) All file systems are not created equal: on the complexity of crafting crash-consistent applications. OSDI '14 (open access; sections read: abstract, 1 introduction with the summary of findings) (behind its links)
Rebello A, Patel Y, Alagappan R, Arpaci-Dusseau AC, Arpaci-Dusseau RH (2020) Can applications recover from fsync failures? USENIX ATC '20 (open access; sections read: abstract, 1 introduction, 2 motivation (the PostgreSQL case), 4 application findings for Redis and LMDB) (behind its links)
Nguyen L-D, Alhomssi A, Ziegler T, Leis V (2025) Moving on from group commit: autonomous commit enables high throughput and low latency on NVMe SSDs. Proc. ACM Manag. Data. doi:10.1145/3725328 (sections read: 1 introduction, 2 commit processing and its bottlenecks, SSD characteristics, latency breakdown, 3 design, YCSB latency results) (behind its links)
Johnson R, Pandis I, Stoica R, Athanassoulis M, Ailamaki A (2010) Aether: a scalable approach to logging. PVLDB 3(1). doi:10.14778/1920841.1920928 (abstract only: the listed EPFL open copy answered 405 to the portal; not pushed) (behind its links)
PostgreSQL 19 Documentation, 28.1 Reliability (read in full) (behind its links)
Pei J, Shmatikov V (2021) BigFoot: exploiting and mitigating leakage in encrypted write-ahead logs. arXiv:2111.09374 (sections read: abstract, 1 introduction, 4 inferring secrets of MongoDB, 5 BigFoot design, overhead summary) (behind its links)
Antonopoulos P et al. (2019) Constant time recovery in Azure SQL Database. PVLDB 12(12):2143-2154. doi:10.14778/3352063.3352131 (VLDB open copy; sections read: abstract, 1 introduction, 2.1 database recovery (analysis, redo, undo), 3.6 aggressive log truncation, the production results paragraph) (behind its links)
Arulraj J, Perron M, Pavlo A (2016) Write-behind logging. PVLDB 10(4). doi:10.14778/3025111.3025116 (VLDB open copy; sections read: abstract and 1 introduction) (behind its links)
PostgreSQL 19 Documentation, 28.5 WAL Configuration (sections read: checkpoints, full_page_writes and checkpoint interval, commit_delay) (behind its links)
Transaction log (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01) (behind its links)
Olson MA, Bostic K, Seltzer M (1999) Berkeley DB. Proceedings of the FREENIX Track, 1999 USENIX Annual Technical Conference (read in full from the open USENIX copy) (behind its links)
Algorithms for Recovery and Isolation Exploiting Semantics (Wikipedia, WME snapshot 2026-12-01) (behind its links)
Durability (database systems) (Wikipedia, WME snapshot 2026-12-01) (behind its links)
Audit trail (encyclopedia) (behind its links)
Choi H, Lee S, Jeong D (2021) Forensic recovery of SQL Server database: practical approach. IEEE Access 9. doi:10.1109/access.2021.3052505 (sections read: introduction, related work on log-based recovery, file structure) (behind its links)
Schneider FB (1990) Implementing fault-tolerant services using the state machine approach: a tutorial. ACM Computing Surveys 22(4):299-319. doi:10.1145/98163.98167 (sections read: 1 state machines, 3 fault-tolerant state machines, 3.1 agreement, order) (behind its links)
Wang, Koshy, Subramanian et al. 2015, Building a Replicated Logging System with Apache Kafka, PVLDB 8(12):1654-1655, doi:10.14778/2824032.2824063 (two-page paper read in full from VLDB's open PDF) (behind its links)
Schneier B, Kelsey J (1999) Secure audit logs to support computer forensics. ACM TISSEC 2(2):159-176. doi:10.1145/317087.317089 (sections read: introduction and description of the problem) (behind its links)
PostgreSQL 19 Documentation, 28.3 Write-Ahead Logging (WAL) (read in full) (behind its links)
Log-structured file system (Wikipedia, WME snapshot 2026-12-01) (behind its links)
Hagmann RB (1987) Reimplementing the Cedar file system using logging and group commit. SOSP '87. doi:10.1145/37499.37518 (abstract only: the portal reached no body and listed no open copy) (behind its links)
Verbitski A et al. (2017) Amazon Aurora: design considerations for high throughput cloud-native relational databases. SIGMOD '17. doi:10.1145/3035918.3056101 (abstract only: portal reached no body; the author-hosted copy answered Access Denied) (behind its links)
SQLite: Atomic Commit In SQLite (sections read: 3.7-3.11, the rollback-journal commit steps) (behind its links)
Peterson RJ, Strickland JP (1983) Log write-ahead protocols and IMS/VS logging. PODS '83. doi:10.1145/588058.588085 (shelf full text, OCR; sections read: the LWA protocol description and the IMS/VS V1 and V1.3 logging history) (behind its links)
MySQL 8.4 Reference Manual, 7.4.4 The Binary Log (sections read: introduction and purposes, the two-phase commit passage) (behind its links)