Course contentsShow
← Software Engineering
Lesson 900 of 1,93328. Transactions and ConsistencyFree lesson

The Durability Property

Guaranteeing that once a transaction commits, its changes persist even in the event of system failures.

The Durability Property

What you'll learn: You'll learn how databases guarantee that committed changes survive crashes and system failures.

What Does Durability Mean?

Durability is the "D" in ACID transactions. It promises that once a transaction commits successfully, its changes are permanent—even if the database server crashes one millisecond later, the power goes out, or the entire system reboots unexpectedly.

Without durability, you'd be placing orders, transferring money, or saving documents with no guarantee those operations would survive beyond the current instant. Every system failure could potentially undo recent work.

How Is Durability Achieved?

Databases ensure durability by writing changes to persistent storage before confirming a commit. This typically involves:

  • Write-Ahead Logging (WAL): Before confirming a transaction, the database writes a record of all changes to a durable log file on disk
  • Forced writes: The database ensures these log entries are physically written to disk (not just sitting in memory buffers)
  • Recovery mechanisms: If the system crashes, the database can replay the log during startup to restore all committed changes

The Trade-off

Durability isn't free. Writing to disk is much slower than working purely in memory. Every commit requires waiting for physical disk writes to complete, which can limit transaction throughput. This is why databases carefully optimize their logging and storage layers.

Think of it like saving a document: clicking "Save" is slower than just typing, but it's what prevents you from losing your work when the application crashes.

Key Takeaway: Durability guarantees that committed transactions persist permanently, even through crashes, by writing changes to durable storage before acknowledging success—trading some performance for data safety.