What do the ACID properties guarantee in a database transaction?
Interview preparation resource from Gate Smashers.
ACID properties guarantee that database transactions behave reliably under errors, concurrency, and system failures by enforcing Atomicity, Consistency, Isolation, and Durability.
Direct answer
ACID properties ensure that database transactions behave reliably even when there are errors, concurrent users, or system failures. Together they guarantee that each transaction is processed safely and predictably.
The four ACID properties
Each letter of ACID describes one guarantee a transaction system must provide.
- Atomicity: A transaction is all-or-nothing. Either every required operation succeeds, or the entire transaction is rolled back.
- Consistency: A successful transaction moves the database from one valid state to another while respecting defined rules and constraints.
- Isolation: Concurrent transactions should behave safely so that intermediate operations do not incorrectly interfere with each other.
- Durability: Once a transaction commits, its changes must survive failures such as a process or system crash.
Concrete example
A bank transfer illustrates how the properties interact: debiting Account A and crediting Account B are treated as one transaction.
- Atomicity in the example: If the credit to Account B fails, Atomicity prevents only the debit from remaining (the whole transaction is rolled back).
- Isolation in the example: Isolation protects the transfer from conflicting concurrent work so intermediate states are not observed by other transactions.
- Consistency and Durability in the example: Consistency keeps database rules valid during the transfer, and Durability ensures that a committed transfer is not lost after a crash.
Overall guarantee
Together, Atomicity, Consistency, Isolation and Durability ensure transactions are reliable and predictable despite errors, multiple concurrent users, or system failures.
