The Four Guarantees
ACID is a set of properties that guarantee database transactions are processed reliably, even in the face of errors, power failures, or concurrent access.
ACID Properties
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ACID Properties β
ββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββ€
β Atomicity β All or nothing β entire transaction β
β β succeeds or entire transaction fails β
ββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββ€
β Consistencyβ Database moves from one valid state to β
β β another β constraints always satisfied β
ββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββ€
β Isolation β Concurrent transactions don't interfere β
β β with each other β as if running sequentiallyβ
ββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββ€
β Durability β Once committed, changes survive crashes β
β β β data is permanently stored β
ββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββ
Example: Bank Transfer
BEGIN;
UPDATE Accounts SET Balance = Balance - 500 WHERE Name = 'Alice';
UPDATE Accounts SET Balance = Balance + 500 WHERE Name = 'Bob';
COMMIT;
Atomicity: Both UPDATEs succeed, or neither does
Consistency: Total balance (Alice + Bob) stays the same
Isolation: Other transactions can't see partial results
Durability: After COMMIT, changes survive a power failure