ContentsThe library

What a Transaction Promises

Both of Them Read 10 and Both of Them Wrote 11

Last timeAll of It or None of It

Two 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.

The previous lesson assumed one transaction at a time. Drop that assumption and

the subject begins.

What running at once means

Two transactions running at the same time are not running simultaneously in any

physical sense. Their steps are shuffled together into a single sequence that

the database chooses, and the resulting sequence is called a schedule.

The important and slightly alarming fact is that almost any shuffle is

permitted. Unless something specifically prevents it, the second statement of

one transaction may run between the first and second statements of the other,

or between the second and third, or anywhere else. Nothing in the fact that the

two transactions are each correct restricts this.

The update that vanishes

Here is the shape that breaks, and it is worth noting how ordinary it looks.

Read a value, compute something from it, write the result back. Counting a

view, decrementing stock, adding to a balance, appending to a list.

The lesson stops here

5 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01The Power Can Fail Between Your Two Statements
  2. 02Both of Them Read 10 and Both of Them Wrote 11you are here
  3. 03Reading Something That Was Never True, and Three Relativesopening only
  4. 04Your Database Is Not Using the Level You Think It Isopening only
  5. 05Take Them All Before You Give Any Backopening only
  6. 06Keep the Old Row and Nobody Has to Waitopening only
  7. 07Both Doctors Checked That Someone Else Was on Callopening only
  8. 08Name the Rule First, Then Pick the Weakest Level That Holds Itopening only

Read alongside