ACID
In one line
ACID stands for Atomicity, Consistency, Isolation, and Durability — the four properties that guarantee reliable database transactions.
In simple words
ACID is an acronym for the four properties that make database transactions reliable:
- Atomicity: The transaction is all-or-nothing. Either every operation succeeds, or none do. If one fails, the whole transaction is rolled back.
- Consistency: The transaction moves the database from one valid state to another. All constraints (foreign keys, unique keys, etc.) must be satisfied after the transaction.
- Isolation: Concurrent transactions do not interfere with each other. Each transaction appears to run as if it were the only one, even if many are running simultaneously.
- Durability: Once a transaction is committed, the changes are permanent — they survive crashes, power failures, and restarts.
Relational databases typically provide full ACID guarantees. Some NoSQL databases relax these (especially Isolation and Consistency) for better performance and scale — this is the CAP theorem trade-off.
Example
-- A transaction that must be ACID-compliant
BEGIN;
UPDATE accounts SET balance = balance - 500 WHERE id = 1;
UPDATE accounts SET balance = balance + 500 WHERE id = 2;
-- Consistency check: total money is unchanged
COMMIT;Atomicity: both updates or neither. Consistency: total balance is preserved. Isolation: other transactions see the transfer as instant. Durability: once committed, the transfer is permanent.
Related terms
Related Resources
Related Lessons
- ACID Properties
Learn the ACID guarantees in depth.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.