SESK: Stuff Everyone Should Know · sesk.info/tech-transaction-atomicity
A bank transfer takes money from Alice and gives it to Bob. Why wrap it in a transaction?
All or nothing: either both steps happen or neither does.
- To make the transfer run faster
- To encrypt the money
- So both steps happen, or neither does ✔
Why: Without a transaction, a crash between the two steps could take money from Alice without giving it to Bob. A transaction bundles the steps, and ROLLBACK cancels everything if something goes wrong.
Huh, didn't know that: This all-or-nothing property is the A in ACID: Atomicity, Consistency, Isolation, Durability.
My transaction was all or nothing. So I got nothing, but at least nobody lost money.
Like this card?
References
Answer: So both steps happen, or neither does. Without a transaction, a crash between the two steps could take money from Alice without giving it to Bob. A transaction bundles the steps, and ROLLBACK cancels everything if something goes wrong.
- PostgreSQL Tutorial: Transactions www.postgresql.org/docs/current/tutorial-transactions.html
The essential point of a transaction is that it bundles multiple steps into a single, all-or-nothing operation.
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.