Database transactions and ACID
In short: A transaction combines several database steps into one unit: either all succeed or none. ACID describes the guarantees behind it.
In more detail: Classic example: transferring €100 from account A to B. Debiting and crediting must succeed together. If power fails in between, everything is rolled back.
In Depth
- A – atomicity: all or nothing.
- C – consistency: database rules (keys, checks) remain satisfied.
- I – isolation: concurrent transactions do not disturb each other. Isolation levels define how strictly.
- D – durability: confirmed changes survive a crash.
- Commands:
BEGIN,COMMIT,ROLLBACK. - Problems: dirty read, non-repeatable read, phantom read, deadlocks (Deadlock).
- Distributed: Across several services there is no simple transaction; patterns such as saga and idempotence help.
See also: Database migration, SQL index