The diagram above explains what ACID means in the context of a database transaction.

Summary
ACID
Atomicity
Atomicity means “all or nothing”. Either every operation succeeds or none of them do.
Consistency
It ensures every completed transaction leaves the database in a valid state.
Isolation
It allows multiple transactions to execute concurrently without interfering with one another.
Durability
It guarantees committed transactions survive failures. Data is persisted after the transaction is committed even in a system failure
Atomicity
The writes in a transaction are executed all at once and cannot be broken into smaller parts. If there are faults when executing the transaction, the writes in the transaction are rolled back.
Imagine transferring money between two bank accounts.
The sender’s balance decreases.
- The receiver’s balance increases.
- If the system crashes after deducting money but before adding it to the second account, the transaction must roll back completely.
- Partial success is unacceptable.
- Atomicity prevents this situation.
Consistency
Unlike “consistency” in CAP theorem, which means every read receives the most recent write or an error, here consistency means preserving database invariants. Any data written by a transaction must be valid according to all defined rules and maintain the database in a good state.
- Database rules remain satisfied before and after each transaction.
- For example, account balances should never become negative if the application prohibits overdrafts.
- Primary keys remain unique.
- Foreign key relationships stay valid.
- Consistency protects the integrity of stored information.
Isolation
Suppose two customers purchase the last available concert ticket simultaneously.
- Without proper isolation, both transactions might succeed.
- Isolation ensures concurrent operations behave as though they executed one at a time, preventing race conditions and inconsistent data.
When there are concurrent writes from two different transactions, the two transactions are isolated from each other. The most strict isolation is serializability, where each transaction acts like it is the only transaction running in the database. However, this is hard to implement in reality, so we often adopt loser isolation level.
Durability
- Once a payment confirmation reaches the customer, that transaction should remain stored even if the database server immediately crashes afterward.
- Durability ensures committed data is not lost because of hardware failures or power outages.
- In a distributed system, this means the data is replicated to some other nodes.