Databases & Data Storage

Transaction Log

Definition

A transaction log (also known as a write-ahead log or WAL) is a file in which the database management system records all changes made to the database before they are written to the main data files. It is a history of actions executed by a DBMS.

Why It Matters

The transaction log is critical for ensuring the "Durability" and "Atomicity" in ACID. In the event of a crash, the database can use the log to recover to a consistent state by replaying or undoing logged transactions.

Contextual Example

Before a database updates a row on disk, it first writes a record of the intended change to the transaction log. This ensures that even if the power goes out during the main write, the change is not lost and the database can recover.

Common Misunderstandings

  • The transaction log is an append-only file, which makes writing to it very fast.
  • It is also the foundation for database replication and Change Data Capture (CDC).

Related Terms

Last Updated: December 17, 2025