Course contentsShow
← Computer Science
Lesson 1663 of 2,87238. Database Transactions and IndexingFree lesson

Durability: Persisting Committed Changes

Learn how durability guarantees that committed transactions survive system failures through persistent storage.

Durability: Persisting Committed Changes

What you'll learn: How databases guarantee that once a transaction commits, its changes survive any system failure—forever.

The Permanence Promise

Durability is the "D" in ACID properties, and it makes a critical guarantee: once you receive confirmation that a transaction committed, those changes are permanent—even if the database server crashes one millisecond later, or the power goes out, or the hardware fails.

Think of it like this: when you mail an important letter and get a receipt, the postal service promises it will arrive even if their truck breaks down. They've accepted responsibility. Similarly, when a database says "commit successful," it's promising your data is safe, no matter what disaster strikes next.

How Durability Works

Databases achieve durability primarily through persistent storage (hard drives, SSDs) and the transaction log (write-ahead log) you learned about earlier. Here's the mechanism:

  1. Before confirming a commit, the database writes all transaction changes to the transaction log on disk
  2. Only after the log is safely persisted does the database return "commit successful"
  3. The actual data pages may be written to disk later (for performance)
  4. If the system crashes, the database replays the transaction log during recovery, reapplying any committed changes that hadn't yet made it to the main data files

This is why write-ahead logging is fundamental—it ensures durability without forcing every data page to disk immediately (which would be slow).

The Contract

When isolation prevents conflicts and atomicity ensures all-or-nothing execution, durability provides the final assurance: committed work is never lost. This is non-negotiable for systems where data represents money, medical records, or any irreplaceable information.

Key Takeaway: Durability guarantees that committed transactions survive any failure by persisting changes to stable storage (typically via transaction logs) before acknowledging success, making data loss impossible once committed.