The anomalies are three shapes, not five concepts
How does counting edges give the isolation levels?
Textbooks list dirty read, non-repeatable read, phantom, write skew and lost update as five separate hazards. If you derive them from the graph instead of listing them, they collapse into a few shapes.
| Anomaly | Shape in the dependency graph |
|---|---|
| Dirty write | A cycle of ww edges only (Adya's name: G0) |
| Dirty read (aborted) | Reading a version whose writer later aborted (G1a) |
| Intermediate read | Reading a version that its writer overwrote before committing (G1b) |
| Circular information flow | A cycle of ww and wr edges (G1c) |
| Non-repeatable read | A cycle with exactly one rw edge, on one item |
| Read skew | A cycle with exactly one rw edge, across two items |
| Lost update | A cycle with one rw edge and a ww edge, on the same item |
| Phantom | A cycle with an rw edge whose "item" is a predicate |
| Write skew | A cycle with two or more rw edges (G2-item) |
Short definitions of the terms you have not seen:
- Dirty write: T1 and T2 write the same row before either commits, and their writes interleave so that no order is coherent.
- Dirty read: reading a value that another transaction has written but not committed (and which may be rolled back).
- Non-repeatable read: reading the same row twice in a transaction and getting two values.
- Read skew: reading two related rows and seeing them at two different moments. Example: you read
mainbefore a transfer andsavingsafter it, so the total looks wrong. It is different from a non-repeatable read, and it is the one that corrupts reports. - Lost update: two read-modify-write cycles on the same row, and one overwrites the other.
- Phantom: a repeated query such as
WHERE amount > 100returns a new row that another transaction inserted. - Write skew: two transactions read overlapping data, each writes a different row, and together they break a rule that either alone would keep.
Non-repeatable read, read skew and lost update are the same shape. That is why a level either permits all three or forbids all three. It is also why the usual textbook treatment as three separate hazards misleads. Write skew is not a stranger either. It is the same family with the number of rw edges raised by one.
Counting gives the levels
The shapes give the levels directly:
| Forbid cycles with… | Level |
|---|---|
| zero rw edges (no G1) | Read Committed |
| one or fewer rw edges | Snapshot Isolation |
| any number of item rw edges | Repeatable Read (Adya's PL-2.99) |
| any rw edges, predicates included | Serializable (PL-3) |
Read that list twice.
- Repeatable Read is serializable minus predicate anti-dependencies. The gap between them is exactly phantoms, nothing else.
- SI and RR are not ordered. SI forbids a one-rw cycle that RR permits, when the edge is predicate-based. RR forbids a two-rw item cycle (write skew) that SI permits. Two levels, neither stronger. Yet the standard presents them as adjacent rungs of one ladder.