ACID — Explained with Examples
ACID is a set of database properties — Atomicity, Consistency, Isolation, Durability — that guarantee reliable processing of database transactions.
ACID stands for Atomicity, Consistency, Isolation, Durability. These four properties ensure that database transactions are processed reliably even in the face of system failures, power outages, or concurrent access.
Why ACID Matters
Without ACID, bank transfers could deduct money from one account without depositing it to another. Shopping carts could lose items mid-checkout. Concurrent users could see inconsistent data. ACID guarantees that data remains correct regardless of failures or concurrency.
The Four Properties
Atomicity — A transaction is all-or-nothing. If any part fails, the entire transaction rolls back.
Consistency — A transaction brings the database from one valid state to another, preserving all defined rules (constraints, cascades, triggers).
Isolation — Concurrent transactions don’t interfere with each other. Each transaction sees a consistent snapshot.
Durability — Once committed, data persists even after a power loss or crash.
Real-World Analogy
An ATM withdrawal: Atomicity — if the cash dispenser jams, your account isn’t debited. Consistency — you can’t withdraw more than your balance. Isolation — your spouse checking the balance at the same time sees either the old or new balance, never a partial deduction. Durability — once the receipt prints, the transaction is permanent.
Example: ACID Transaction in SQL
-- Atomic: both updates happen, or neither does
BEGIN TRANSACTION;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
-- If either update fails, ROLLBACK reverts both
COMMIT;Related Terms
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro