ACID
ACID
Definition
ACID is the acronym for the four properties a reliable transaction must guarantee: Atomicity, Consistency, Isolation, Durability. Each is covered in depth in its own topic (22.5-22.8); this topic introduces them together as a unified framework.
How It Works
| Letter | Property | One-line meaning |
|---|---|---|
| A | Atomicity | All-or-nothing — no partial completion |
| C | Consistency | The database moves from one valid state to another valid state |
| I | Isolation | Concurrent transactions don't interfere with each other's intermediate state |
| D | Durability | Once committed, changes survive even a crash |
These four properties together are WHY a transaction can be trusted as a reliable building block for correct application logic, even in the presence of concurrent users, hardware failures, and bugs.
Edge Cases and Pitfalls
- The four letters are often taught as if they're independent, but they interact: Atomicity is partly what makes Consistency achievable (an incomplete update could leave data inconsistent), and Isolation exists specifically to prevent concurrent transactions from seeing each other's not-yet-atomic, in-progress state.
- Not every storage engine provides full ACID guarantees — as discovered practically in this course, MySQL's default
MyISAMengine does NOT support transactions at all (no real Atomicity/Isolation/Durability for multi-statement operations), whileInnoDBdoes; choosing a transactional storage engine is a prerequisite for ACID to mean anything. - "Consistency" in ACID is sometimes confused with the "C" in the CAP theorem (a distributed-systems concept covered in Chapter 38) — they are related but NOT the same concept; ACID's Consistency is about respecting the database's own constraints/rules, while CAP's Consistency is about all nodes seeing the same data at the same time in a distributed system.
Key Takeaways
- ACID = Atomicity, Consistency, Isolation, Durability — the four guarantees a reliable transaction provides.
- These properties depend on the storage engine actually supporting transactions (e.g. InnoDB, not MyISAM).
- ACID's "Consistency" and the CAP theorem's "Consistency" (Chapter 38) are related but distinct concepts — don't conflate them.