Database ACID

Think of ACID as the “Gold Standard” for database transactions. It is a set of four properties that guarantee a database remains reliable and accurate, even if the power goes out, the system crashes, or multiple people try to change the same data at once.
To make this real, imagine you are transferring $100 from your Savings account to your Checking account.
The Four Pillars of ACID
1. Atomicity (“All or Nothing”)
Atomicity ensures that a transaction is treated as a single “unit.” Either the entire operation succeeds, or none of it happens.
In our bank example, the transaction has two steps:
- Subtract $100 from Savings.
- Add $100 to Checking.
If the system crashes after step 1 but before step 2, Atomicity ensures the $100 isn’t just “lost” in the void. The database will roll back the change so your Savings balance stays exactly where it was.
2. Consistency (Rules Stay Intact)
Consistency ensures that a transaction takes the database from one valid state to another, following all predefined rules (constraints).
If your bank has a rule that an account balance can never be negative, and you try to transfer $500 when you only have $200, the database will reject the transaction because it violates the “Consistency” of the data rules.
3. Isolation (No Peeking)
In a busy database, thousands of transactions happen at once. Isolation ensures that concurrent transactions don’t interfere with each other.
If you are transferring money while your spouse is simultaneously checking the joint account balance, Isolation ensures they see either the balance before the transfer or afterโnever a confusing “in-between” state where the money has left one account but hasn’t arrived in the other.
4. Durability (Built to Last)
Once a transaction is “committed” (confirmed as successful), it stays savedโeven if the power fails or the database crashes immediately afterward. The record is written to non-volatile memory (like a hard drive or SSD) so it canโt be wiped out of temporary RAM.
Why does it matter?
Without ACID, databases would be prone to “corrupt data”โmissing money, duplicate records, or ghost entries. While some modern “NoSQL” databases trade off some ACID properties for extreme speed (often called BASE), ACID remains the backbone of financial systems, healthcare records, and any application where data integrity is non-negotiable.
Summary Table
| Property | Plain English Definition |
| Atomicity | The whole transaction succeeds or fails together. |
| Consistency | The data follows all the “rules” of the system. |
| Isolation | Transactions don’t trip over each other. |
| Durability | Once saved, the data is permanent. |
Gemini
