Thursday, June 28, 2018

ACID Cheat Sheet

This on is for Database Transactions

  • Atomicity – The transaction is all or nothing. Succeeds or fails as a unit.
    If the bank adds $100 to my account, then the $100 must come from your account.
  • Consistency – Outside of the transaction, we can only see the begin or end state of the transaction.
    We will never see the half of the transaction where I get the $100 and you haven’t given up your $100. (too bad).
  • Isolation – The transaction is hidden from the outside world until it is committed.
    I imagine that during a transaction there are two universes. In the transaction’s universe, the values change as you work though the steps. In the other universe, the values remain as they were before.
  • Durability – Once the transaction is committed, it is on the record forever.
    If they decide that I shouldn’t have gotten the $100 from you after the transaction was committed, they can create a new transaction where they take the $100 away from me, but they can’t reverse the committed transaction. You can’t rewrite history.