Sub topic 7
View Serializability and Its Relation to Conflict Serializability
Prerequisites and the main idea
Assume you know transactions, schedules, read and write operations, and directed graphs. A serial schedule runs each transaction completely before starting another. A view-serializable schedule may interleave transactions, but it has the same observable reads and final database values as some serial schedule.
View serializability uses three conditions. Two schedules are view equivalent when:
- If a transaction reads the initial value of an item in one schedule, it reads the initial value in the other.
- If a transaction reads a value written by another transaction, it reads from the same transaction in both schedules.
- The same transaction performs the final write on each data item.
The serial schedule that matches these conditions is called an equivalent serial order.
Conflict serializability is stricter
Two operations conflict when they:
- Belong to different transactions.
- Access the same data item.
- At least one operation is a write.
Thus, read-write, write-read, and write-write pairs can conflict. A schedule is conflict serializable when its precedence graph is acyclic. A topological ordering of that graph gives an equivalent serial order.
Every conflict-serializable schedule is view serializable. The reverse is not always true.
| Property | Conflict serializability | View serializability |
|---|---|---|
| Main test | Acyclic precedence graph | Matching reads-from and final writes |
| Handles blind writes | Usually rejects some valid schedules | Can accept them |
| Relationship | Subset of view serializability | Superset of conflict serializability |
A blind write is a write that does not use a value previously read by the same transaction. Blind writes explain why view serializability can accept schedules that conflict serializability rejects.
Worked example
Consider this schedule:
w1(X), w2(X), w1(X)
There are no read operations. The final write on X belongs to transaction T1. Therefore, the schedule has the same observable result as the serial order T2, T1: that order also ends with T1 writing X.
However, the precedence graph contains two edges:
T1 → T2, because the firstw1(X)precedesw2(X).T2 → T1, becausew2(X)precedes the finalw1(X).
These edges form a cycle, so the schedule is not conflict serializable. It is nevertheless view serializable because the only relevant observation is the final writer, T1, and the serial order T2, T1 has the same final writer.
How to solve GATE-style questions
For a small schedule:
- Record which transaction each read obtains its value from, including the initial value.
- Record the final writer for every data item.
- List possible serial orders.
- Check whether one serial order preserves all recorded read sources and final writers.
- Separately construct the precedence graph if conflict serializability is also asked.
Do not conclude that a cycle automatically rules out view serializability. A cycle rules out conflict serializability. View serializability requires the separate read-source and final-write test.
Exercise
Is w1(X), w2(X), w1(X) conflict serializable, view serializable, both, or neither?
Show answer
It is view serializable but not conflict serializable. The serial order T2, T1 has the same final writer, T1, while the precedence graph contains the cycle T1 → T2 → T1.