ACID stands for:
A – Atomicity
C – Consistency
I – Isolation
D – Durability
Together, they ensure that database transactions are processed reliably and securely.
🔹 Atomicity – "All or Nothing"
✅ Definition:
Atomicity ensures that either all operations in a transaction are performed, or none are. If one part fails, the entire transaction is rolled back.
💡 Example:
In a banking system:
Debit ₹500 from Account A
Credit ₹500 to Account B
If the debit succeeds but the credit fails, the ₹500 must be restored to Account A. Partial changes are not allowed.
🔁 Handled by:
COMMIT(to save)ROLLBACK(to undo)
🔹 Consistency – "Valid from Start to End"
✅ Definition:
Consistency ensures that the database remains in a valid state before and after the transaction. Any transaction must preserve the rules, constraints, and integrity of the database.
💡 Example:
If an account can't go below ₹0, a withdrawal transaction violating this will be rejected.
Foreign key and check constraints are examples of consistency rules.
A transaction cannot leave the DB in an invalid state.
🔹 Isolation – "Transactions Don’t Interfere"
✅ Definition:
Isolation ensures that concurrent transactions do not affect each other's execution. The final result should be as if the transactions ran one after the other (serially).
💡 Example:
Two people buying the last movie ticket at the same time:
Without isolation: both may book it — data corruption.
With isolation: one succeeds, the other waits or fails.
🔐 Implemented via:
Isolation levels:
READ UNCOMMITTED,READ COMMITTED,REPEATABLE READ,SERIALIZABLE
🔹 Durability – "Permanent Effect"
✅ Definition:
Once a transaction is committed, the changes are permanent — even in the event of a power failure, crash, or system error.
💡 Example:
If money is transferred and the system crashes, once the transaction is committed, it won’t be reversed — changes are written to disk/logs.
📌 Summary Table
Property | Purpose | Key Point |
|---|---|---|
Atomicity | All or nothing execution | No partial success |
Consistency | Maintain DB integrity | Rules & constraints always satisfied |
Isolation | Transactions are independent | Avoid conflicts during concurrent access |
Durability | Changes are permanent | Survive crashes or failures |