ACID Properties Explained
Atomicity, consistency, isolation, and durability with concrete examples.
Why Interviewers Ask About ACID
When a senior interviewer says "walk me through ACID", they are not testing whether you memorized four words. They want to know if you understand what a database guarantees when many users hit it at once.
ACID stands for Atomicity, Consistency, Isolation, and Durability. Every transactional database (Postgres, MySQL/InnoDB, SQL Server, Oracle) promises these four properties for work wrapped in a transaction.
The strongest answers tie each letter to a concrete failure it prevents. Over the next scenes we will do exactly that.
What Is a Transaction?
A transaction is a unit of work that the database treats as a single, indivisible step. You open it with BEGIN, do one or more statements, then either COMMIT to make it permanent or ROLLBACK to discard everything.
The classic example is a bank transfer: debit one account, credit another. Both must happen or neither. A transaction is the wrapper that lets you make that promise.
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;All lessons in this course
- ACID Properties Explained
- The Four Isolation Levels
- Dirty, Non-Repeatable and Phantom Reads
- Deadlocks, Locking and MVCC