Caffeinated Coder
Book an appointment
Lesson 14 · Inside a database

Transactions and ACID

A transaction groups several SQL statements into one unit of work that the database runs all or nothing. Follow a bank transfer of 100 from Ann to Ben inside PostgreSQL: row versions and locks while it runs, a reader that never sees the half-done transfer, the write-ahead log flushed to disk before COMMIT returns, a crash that is repaired by replaying that log, and a second transfer that breaks a CHECK rule and is rolled back. Together they are the four ACID promises.

14 min11 steps5 questionsAdvanced
Fig 14 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.