- Subtract $10 from the savings account row.
- Add $10 to the checking account row.

- The second update never happens (we remove $10 from savings but never add it to checking).
- A concurrent process inspects the accounts between the two updates and sees an inconsistent intermediate state (for example: 50 in checking), which does not add up to the $70 the bank owes you.
- Atomicity: All updates in the transaction are treated as a single unit. Either every update succeeds, or none are applied.
- Consistency: The database moves from one valid state to another valid state. Constraints and business rules are preserved.
- Isolation: Concurrent transactions do not see each other’s intermediate states. Observers see either the state before the transaction or the state after it completes.
- Durability: Once a transaction commits, its effects survive system failures.

- If both updates succeed, the database commits the changes (final state: 60 checking).
- If any step fails, the database rolls everything back to the original consistent state (original: 50 checking).

Different database systems implement ACID with varying default isolation levels and concurrency mechanisms. Be aware of your DBMS’s settings (for example:
READ COMMITTED, REPEATABLE READ, SERIALIZABLE) because they affect visibility, performance, and concurrency.- Keep transactions short to reduce locking and contention.
- Use appropriate isolation levels for your workload: higher isolation reduces anomalies but can decrease concurrency.
- Validate constraints inside the transaction (for example, check for sufficient funds) to maintain consistency.
- Test failure paths (e.g., simulate errors or crashes) to ensure rollbacks work as expected.
- Transaction integrity ensures multi-step operations behave as single, indivisible actions.
- Use transaction control statements (
BEGIN,COMMIT,ROLLBACK) and understand ACID to preserve correctness under errors and concurrency. - When designing systems, balance isolation needs against performance and concurrency requirements.
- Kubernetes Documentation
- Docker Hub
- Transaction Isolation Levels — PostgreSQL
- ACID Properties — Wikipedia