Graph
Write-Ahead Logging

🧾Write-Ahead Logging

NEW

Also known as: WAL

A durability technique that records changes to an append-only log before applying them to data pages, enabling crash recovery.

DESCRIPTION

Write-Ahead Logging ensures durability by persisting redo information before modifying database pages. If a crash occurs, the system replays committed log records to recover data to a consistent state. WAL underpins many ACID-compliant engines and supports checkpoints to bound recovery time. Implementations vary in log structure, buffer management, and group commit strategies. ARIES is a foundational algorithm guiding many WAL designs. WAL also supports replication by streaming log records to replicas. Proper log sizing and I/O configuration are critical for throughput.

ALTERNATIVE DEFINITIONS

PostgreSQL Documentation

Write-Ahead Logging (WAL) is a standard method for ensuring data integrity by writing changes to a log before the data files.

Emphasizes integrity and the write-before-data rule.

Source

SQLite Documentation

Write-Ahead Logging provides a high-concurrency alternative to a rollback journal by writing changes into a separate WAL file.

Contrasts WAL with rollback journaling and highlights concurrency benefits.

Source

ACM (ARIES Paper)

ARIES is a recovery method that supports fine-granularity locking and partial rollbacks using write-ahead logging.

Foundational academic definition linking WAL to ARIES recovery.

Source

ACID Durability Transaction Log Checkpoint Crash Recovery ARIES Undo Log Journaling Replication

COMPETING TERMS

Shadow Paging

RELATIONS

KNOWLEDGE AREAS

Data Storage & Operations Data Engineering Data Security Data Architecture

TARGET AUDIENCE

Data Engineer Software Developer DevOps Engineer Data Architect

EXTERNAL SOURCES

TOP QUESTIONS

Why is Write-Ahead Logging important?

It guarantees durability and crash recovery by persisting redo records before data changes. Without WAL, committed transactions could be lost on failure.

Category: Relevancy

How does WAL interact with checkpoints?

Checkpoints flush dirty pages and record a consistent point in the log, reducing recovery time by bounding the amount of log replay required.

Category: Example

What is a common mistake configuring WAL?

Choosing too small log segments or slow disks can throttle throughput. Proper sizing and fast, sequential I/O devices are essential.

Category: Mistakes

Does WAL increase write amplification?

Yes, WAL writes changes twice—first to the log and then to data files. Group commit and batching mitigate overhead.

Category: Risks

How does WAL enable replication?

By streaming log records to replicas, which apply them in order, replicas stay consistent and can fail over if the primary fails.

Category: Example

What is the relationship between WAL and ARIES?

ARIES is a recovery algorithm that relies on WAL for redo and undo. Many databases implement ARIES-inspired techniques.

Category: Definition

Can WAL be disabled?

In production, no—it’s critical for durability. Some systems provide minimally-logged or bulk modes with trade-offs for speed versus safety.

Category: Opinion

What’s a hot topic around WAL?

Integrating WAL with cloud object storage and tiered logging is an active area to balance cost, durability, and performance.

Category: Topic

How does WAL differ from shadow paging?

Shadow paging writes new versions elsewhere and swaps pointers, avoiding redo logs. WAL logs changes before updating in place.

Category: Alternatives