The library

Where the data lives

State precisely what each isolation level does and does not prevent, well enough to pick one deliberately, to recognise the bug a weaker one allows, and to explain why your correct-looking code lost an update

What a Transaction Promises

Transactions are sold as all-or-nothing and that is the least interesting part. This course is about what happens when two of them run at once: which anomalies each level permits, how the levels are implemented, and why the default is weaker than you think.

8 lessons, written and corrected before you arrived. Reading them here needs no account. The first reads the whole way through; the others open and then stop, because a page nobody owns cannot tell who is reading it. Starting the course gives you your own copy, where every idea has problems standing under it and you can ask about any sentence.

Start reading

  1. 01The Power Can Fail Between Your Two StatementsTaking money out of one account and putting it into another is two writes, and a crash between them is a real event. Here is the mechanism that makes it one.
  2. 02Both of Them Read 10 and Both of Them Wrote 11opening onlyTwo transactions that are each obviously correct can interleave into a result that is obviously wrong. Writing one of those schedules out is where this subject starts.
  3. 03Reading Something That Was Never True, and Three Relativesopening onlyThere are four named ways concurrent transactions interfere. Each has a schedule you can write in six lines and a precise condition that lets it happen.
  4. 04Your Database Is Not Using the Level You Think It Isopening onlyFour named levels, each forbidding a longer list of anomalies. The one you are on by default forbids the least interesting of them and permits the two that bite.
  5. 05Take Them All Before You Give Any Backopening onlyTwo kinds of lock, one rule about when you may release them, and that rule alone is enough to guarantee the serial order. It also makes a new failure possible.
  6. 06Keep the Old Row and Nobody Has to Waitopening onlyWriters make a new version rather than overwriting, so every reader sees the database as it was when it started and never waits for anybody. One gap survives.
  7. 07Both Doctors Checked That Someone Else Was on Callopening onlyTwo transactions, two different rows, both reading a rule that spans several rows and each one breaking it on the strength of the other holding it up.
  8. 08Name the Rule First, Then Pick the Weakest Level That Holds Itopening onlyThe level is not a preference, it is derived from the rule you need to keep. And every level above the default hands you an error you are obliged to retry.