Acid Properties
ACID properties: Atomicity, Consistency, Isolation, Durability.
ACID is a set of properties that guarantees reliable and safe database transactions. ACID stands for: A → Atomicity C → Consistency I → Isolation D → Durability
ACID Properties
These properties ensure that database transactions always remain correct even if failures happen.
A transaction must either complete fully or not happen at all.
Account A = 500. Account B = 200 transfer = 100 steps: Account A = 500 - 100 = 400 Account B = 200 + 100 = 300
A transaction must move the database from one valid state to another valid state. Account A = 500. Account B = 200 total money = 500 + 200 = 700 transfer = 100 steps: Account A = 500 - 100 = 400 Account B = 200 + 100 = 300 total money = 400 + 300 = 700
Multiple transactions should not interfere with each other. Time → T1: Read A=1000 T1: Update A=500 T1: (Not committed) T2: Read A -> 500 (wrong) 1000 (right)
| Property | Meaning | | ----------- | ---------------------------- | | Atomicity | All or nothing | | Consistency | Database rules remain valid | | Isolation | Transactions don't interfere | | Durability | Committed data is permanent |
Once a transaction is committed, it will never be lost even if the system crashes. T1: A=1000 T2: Update A=1000+500 T3: Comitted A=1500 System Crashes A = 1500 Data will be persistent replication, transaction logs