Loading learning content...
Having established view equivalence as a semantic notion of schedule similarity, we now turn to the central question: Which schedules are correct according to view equivalence?
The answer defines view serializability—a schedule is view serializable if it is view equivalent to at least one serial schedule. This criterion captures the broadest class of schedules that can be considered correct from a semantic standpoint: they produce the same observable behavior as some sequential execution.
View serializability represents the theoretical upper bound on what schedules we can safely permit while maintaining database consistency. Any schedule that is not view serializable produces results that no sequential execution could produce—a clear indicator of incorrect concurrent behavior.
By the end of this page, you will understand the formal definition of view serializability, how to determine if a schedule is view serializable by checking view equivalence against all possible serial schedules, the significance of view serializability as a correctness criterion, and key examples demonstrating view serializable schedules.
Definition: A schedule S over a set of transactions {T₁, T₂, ..., Tₙ} is view serializable if there exists a serial schedule S' over the same transactions such that S is view equivalent to S'.
Formally: S is view serializable ⟺ ∃ serial schedule S' such that S ≡ᵥ S'
Unpacking the Definition:
Serial Schedule: A schedule where transactions execute one at a time, with no interleaving. For n transactions, there are n! possible serial schedules.
View Equivalent (≡ᵥ): As defined in the previous page—same initial reads, same read-from relationships, same final writes.
Existence Quantifier (∃): We only need to find ONE serial schedule to which S is view equivalent. S doesn't need to be view equivalent to all serial schedules—just at least one.
The set of all view serializable schedules is denoted VSR (View Serializable Schedules).
A schedule being view serializable means there is at least one 'witness' serial schedule that it matches semantically. If no such serial schedule exists—if S differs from ALL serial schedules in terms of view equivalence—then S is not view serializable and represents incorrect concurrent execution.
The Naive Testing Approach:
Given the definition, one might consider this algorithm to test view serializability:
For each permutation π of transactions (there are n! of them):
Construct serial schedule S_π based on order π
If S ≡ᵥ S_π:
Return "S is view serializable"
Return "S is not view serializable"
This approach is correct but has factorial time complexity—O(n!) permutations to check, each requiring polynomial time to verify view equivalence. For even modest numbers of transactions, this becomes intractable.
However, understanding this naive approach is pedagogically valuable: it makes explicit that view serializability is defined relative to the existence of at least one equivalent serial schedule.
Let's work through a detailed example demonstrating a view serializable schedule.
Setup:
Transaction Operations:
R₁(X), W₃(X), W₁(X), W₁(Y), R₂(Y)
Operation sequence:
1. R₁(X) — T₁ reads initial X (0)
2. W₃(X) — T₃ writes X (blind write)
3. W₁(X) — T₁ writes X (overwrites T₃'s value)
4. W₁(Y) — T₁ writes Y
5. R₂(Y) — T₂ reads Y written by T₁Final state: X has T₁'s value, Y has T₁'s valueNote that T₃'s write to X is a blind write (no preceding read), and it gets overwritten by T₁. Let's check if this schedule is view serializable.
Analysis: Check Against Serial Schedule T₃; T₁; T₂
Serial Schedule T₃; T₁; T₂:
Check View Equivalence (S vs T₃; T₁; T₂):
Condition 1: Initial Read Preservation
❌ This serial schedule doesn't match!
Try Serial Schedule T₁; T₃; T₂:
Check View Equivalence (S vs T₁; T₃; T₂):
Condition 1: Initial Read Preservation
Condition 2: Read-From Relationships
Condition 3: Final Write Preservation
❌ Final writes to X don't match! S has T₁'s write as final, but T₁; T₃; T₂ has T₃'s write as final.
Try Serial Schedule T₃; T₁; T₂ (revisited with correct understanding):
Wait—let me reconsider the original schedule S more carefully:
We need a serial schedule where:
Serial Schedule T₁; T₂; T₃:
Serial Schedule T₁; T₃; T₂:
Serial Schedule T₃; T₁; T₂:
This particular schedule S appears NOT to be view serializable! Let me construct a proper example that IS view serializable to demonstrate the concept correctly.
Corrected Example: A Truly View Serializable Schedule
Setup:
Schedule S: W₁(X), W₂(X)
Analysis:
Serial Schedule T₁; T₂:
Conclusion: S ≡ᵥ (T₁; T₂), so S is view serializable.
This is actually the same as the serial schedule, so it's trivially view serializable. Let's create a more interesting example.
The most instructive examples of view serializability involve blind writes. These schedules are view serializable but NOT conflict serializable—showcasing the extra permissiveness of view serializability.
Setup:
R₁(X), W₂(X), W₁(X), W₃(X)
1. R₁(X) — T₁ reads initial X
2. W₂(X) — T₂ blindly writes X
3. W₁(X) — T₁ writes X
4. W₃(X) — T₃ blindly writes X (final write)Final state: X has T₃'s valueT₂'s write is overwritten by T₁, and T₁'s write is overwritten by T₃. The order of intermediate writes (T₂ and T₁) doesn't affect the final state or what any transaction reads.
Find a View-Equivalent Serial Schedule:
We need a serial schedule where:
Candidate: Serial Schedule T₁; T₂; T₃
Verify View Equivalence:
| Condition | Schedule S | Serial T₁;T₂;T₃ | Match? |
|---|---|---|---|
| R₁(X) reads initial | Yes | Yes | ✓ |
| Read-from relationships | None (only initial read) | None | ✓ |
| Final write to X | W₃(X) | W₃(X) | ✓ |
Conclusion: S ≡ᵥ (T₁; T₂; T₃), so S is view serializable.
In schedule S, we have: W₂(X) before W₁(X), and W₁(X) before W₃(X). These are write-write conflicts. In serial T₁;T₂;T₃, the order is W₁(X) before W₂(X) before W₃(X). The W₁-W₂ conflict order is reversed! Conflict serializability requires preserving all conflict orders, but view serializability only cares about what's read and what's final. Since no one reads T₁'s or T₂'s writes to X, their order doesn't matter semantically.
Key Insight:
The schedule S is view serializable because:
In such cases, the exact position of T₂'s write relative to other operations is flexible—as long as the initial reads, read-from relationships, and final writes are preserved.
This flexibility is exactly what distinguishes view serializability from conflict serializability. Conflict serializability treats all conflicts as order-sensitive; view serializability realizes that some conflicts are semantically irrelevant.
Understanding what makes a schedule not view serializable is equally important. A schedule fails to be view serializable when its read-from relationships and/or final writes cannot be matched by any serial schedule.
Setup:
R₁(X), R₂(Y), W₁(Y), W₂(X)
1. R₁(X) — T₁ reads initial X
2. R₂(Y) — T₂ reads initial Y
3. W₁(Y) — T₁ writes Y
4. W₂(X) — T₂ writes XFinal state: X = T₂'s value, Y = T₁'s valueBoth transactions read initial values, then write. Let's see if this matches any serial schedule.
Analysis Against All Serial Schedules:
Serial Schedule T₁; T₂:
In S: R₂(Y) reads initial Y. In T₁;T₂: R₂(Y) reads T₁'s Y.
❌ Read-from relationship mismatch!
Serial Schedule T₂; T₁:
In S: R₁(X) reads initial X. In T₂;T₁: R₁(X) reads T₂'s X.
❌ Read-from relationship mismatch!
Conclusion: S is view equivalent to neither serial schedule. Therefore, S is NOT view serializable.
This schedule requires that both T₁ and T₂ read initial values, but in any serial schedule, one transaction must complete before the other starts. This means one transaction's reads will occur before the other transaction's writes, but the other transaction's reads will occur AFTER those writes. It's impossible to have both transactions read initial values in a serial schedule.
The Impossibility Explained:
In schedule S:
But in any serial schedule (T₁;T₂ or T₂;T₁), the second transaction's reads will occur AFTER the first transaction's writes. There is no way to serialize the transactions while preserving the fact that both read initial values.
This is a form of circular dependency:
Both cannot be 'first' simultaneously in a serial schedule.
We can characterize view serializable schedules through their read-from relationships and final writes. A schedule is view serializable if and only if there exists a total ordering of transactions that is consistent with these relationships.
The Ordering Constraints:
Given a schedule S, define the following ordering requirements for any potential equivalent serial schedule:
Initial Read Constraint: If Tᵢ reads the initial value of X in S, then no transaction that writes to X can precede Tᵢ in the serial order.
Read-From Constraint: If Tⱼ →X Tᵢ in S (Tᵢ reads X from Tⱼ), then:
Final Write Constraint: If Tᵢ performs the final write to X in S, then:
| Constraint Type | Condition in S | Serial Order Requirement |
|---|---|---|
| Initial Read | Rᵢ(X) reads initial value | All writers of X must follow Tᵢ |
| Read-From | Tⱼ →X Tᵢ | Tⱼ < Tᵢ, and no Wₖ(X) between them |
| Final Write | Wᵢ(X) is final write | All other writers of X precede Tᵢ |
Testing View Serializability:
A schedule S is view serializable ⟺ there exists a serial ordering of transactions that satisfies ALL the above constraints simultaneously.
This is equivalent to asking: can we find a topological ordering of the transactions that respects all the constraints derived from S's read-from relationships and final writes?
Unfortunately, testing this is computationally hard—NP-complete in general. We'll explore this in detail in a later page.
The constraints can be modeled as a graph where nodes are transactions and edges represent 'must precede' relationships. A valid serial ordering exists iff this graph has a topological order—iff the graph is acyclic. However, the presence of 'no transaction in between' constraints makes this more complex than simple precedence graph analysis.
View serializability has several important properties that define its place in the hierarchy of correctness criteria.
Property 1: VSR ⊇ CSR (Superset Relationship)
Every conflict serializable schedule is also view serializable, but not vice versa.
The schedules in VSR but not in CSR are exactly those with blind writes where the order of writes that get overwritten can be rearranged.
Property 2: View Serializability Preserves Database Consistency
If each transaction in isolation transforms a consistent database state to another consistent state, then any view serializable schedule will also preserve consistency.
This follows from view equivalence to a serial schedule: the serial schedule preserves consistency (by sequential consistency guarantee), and view equivalence ensures the same final state.
Property 3: View Serializability is Testing-Intractable
Determining whether a schedule is view serializable is NP-complete. This is a critical difference from conflict serializability, which can be tested in polynomial time using precedence graphs.
Property 4: Composability
View serializability has limited composability: the union of two view serializable schedules (over disjoint transaction sets or data items) may not be view serializable. This makes it challenging to use in distributed systems without global coordination.
Property 5: Recoverable Schedules
View serializability is orthogonal to recoverability. A view serializable schedule may or may not be recoverable. For practical use, we need schedules that are both view serializable AND recoverable (or cascadeless/strict).
Due to the NP-completeness of testing, view serializability is primarily of theoretical interest. Practical concurrency control mechanisms use conflict serializability (via 2PL) or timestamp-based protocols that guarantee conflict serializability. View serializability helps us understand the theoretical limits of correctness but is too expensive to test directly.
We have established the concept of view serializability—the broadest semantically-grounded correctness criterion for concurrent schedules. Let's consolidate the key points:
What's Next:
Having established both view serializability and conflict serializability, we're ready to explore their detailed comparison. We'll examine exactly when they differ, why conflict serializability is preferred in practice, and what theoretical insights view serializability provides.
You now understand view serializability—the class of schedules that are view equivalent to some serial schedule. You can identify view serializable schedules, understand why blind writes create the distinction between VSR and CSR, and appreciate the theoretical importance of this concept.