Type a branch, a subject or a topic — “round robin”, “paging”, “civil”.

Conflict Serialisability

Build the precedence graph, look for a cycle. One theorem decides whether a schedule is safe.

Skip to the animation

A schedule is conflict serialisable if its precedence graph has no cycle — which is exactly the condition for it to produce the same result as some serial order of the same transactions.

The standard of correctness

Running transactions one at a time is correct by definition. Interleaving them is faster, and the question is whether a particular interleaving is still correct. Serialisability is the answer: a schedule is acceptable if its effect matches *some* serial order — any one will do, and nobody has to say in advance which.

Conflict serialisability is a slightly stricter, and much more checkable, version of that idea. It asks whether the schedule can be turned into a serial one by repeatedly swapping adjacent operations that do not conflict.

The vocabulary

Functional dependency (X → Y)
Knowing X pins down Y. If two rows agree on X they must agree on Y. This is a statement about the world being modelled, not about the rows that happen to be in the table today.
Superkey and candidate key
A superkey determines every attribute in the relation. A candidate key is a superkey with nothing spare in it — remove any attribute and it stops working.
Prime attribute
One that appears in some candidate key. The normal forms are mostly rules about how non-prime attributes are allowed to depend on prime ones.
Partial dependency
A non-prime attribute determined by only part of a composite key. Forbidden by 2NF, and the direct cause of the update, insert and delete anomalies.
Transitive dependency
Key → X → Y where X is not a key. Forbidden by 3NF: the fact really belongs in a table keyed by X.
Lossless decomposition
Splitting a relation so that re-joining it gives back exactly the original rows — no more, no fewer. Guaranteed when the shared attribute is a key of one of the two pieces.

What counts as a conflict

PairSame item?Conflict?
read / readyesno — neither changes anything
read / writeyesyes
write / readyesyes
write / writeyesyes
anythingnono

Two operations conflict when they are from different transactions, touch the same item, and at least one writes. Non-conflicting operations can be reordered freely without changing any outcome — so only the conflicts pin down the ordering.

Building and testing the graph

  1. 1Draw one node per transaction.
  2. 2For every conflicting pair where Ti's operation comes before Tj's in the schedule, draw an edge Ti → Tj.
  3. 3Look for a cycle.
  4. 4No cycle: the schedule is conflict serialisable, and any topological sort gives an equivalent serial order.
  5. 5A cycle: it is not, and no serial order produces the same result.

Each edge is a constraint saying *this transaction must come first*. A cycle means a transaction must precede itself, which no ordering can satisfy — that is the entire proof.

Why databases do not actually use this test

The precedence graph can only be built once the schedule exists — and by then any damage has been done. It is an analysis tool, not a scheduler.

Two-phase locking earns its place by guaranteeing in advance that the graph will be acyclic, without ever building it. The test is what proves the protocol is worth using; the protocol is what you actually run.

Advantages and disadvantages

Advantages

  • A precise, mechanical test — cycle detection, nothing more.
  • A topological sort of an acyclic graph hands you the equivalent serial order for free.
  • It is what justifies concurrency control protocols in the first place.

Disadvantages

  • Can only be applied after the fact, so it cannot prevent anything.
  • Slightly stricter than necessary — it rejects some schedules that are view serialisable.
  • Says nothing about recoverability, which has to be checked separately.

Watch it work

loading visualisation…

Check yourself

question 1 / 4

One question at a time. Pick an answer to see why it is right or wrong, then move on — there is no score to keep and nothing is saved.

Which pair of operations conflicts?
How do you decide whether a schedule is conflict serialisable?
A schedule is view serialisable but not conflict serialisable. What does that mean?
Why is serialisability the correctness criterion at all?

0 / 4

4 still unanswered — the dots above jump straight to them.