Transactions and ACID
What a database transaction is and the four ACID guarantees behind it: atomicity, consistency, isolation and durability, explained with a money transfer, plus commit and rollback in SQL and code, and the mistakes that leave data half-changed.
CodexBash, , 5 min read
Moving money from one account to another takes two updates: subtract from one, add to the other. If the server crashes between them, money vanishes. If two transfers run at the same moment, the balances can end up wrong. Transactions exist to make groups of changes safe against crashes and against each other, and ACID names the four guarantees they provide. This article explains each, using that transfer as the running example.
Sign in to read the rest
The whole 5 minute article is free with an account, along with every problem, lesson and tutorial. No card.