Loading learning content...
We now have two formal criteria for schedule correctness: conflict serializability and view serializability. Both aim to identify schedules that are 'equivalent' to some serial schedule, but they define 'equivalence' differently.
Conflict serializability focuses on the structure of operations—specifically, the order of conflicting operations. View serializability focuses on the semantics—what values transactions read and what values persist.
This distinction has profound implications:
This page provides a rigorous, comprehensive comparison that reveals when and why these criteria differ.
By the end of this page, you will understand the precise relationship between VSR and CSR, the exact conditions under which they differ (blind writes), why conflict serializability is preferred in practice, and how to identify schedules that fall into VSR\CSR (view serializable but not conflict serializable).
Before comparing view and conflict serializability specifically, let's situate them within the broader hierarchy of schedule classes.
The Complete Hierarchy (from most restrictive to least restrictive):
Containment Relationships:
What Each Set Difference Contains:
| Set Difference | Contains | Characteristics |
|---|---|---|
| CSR \ Serial | Non-serial but conflict serializable schedules | Interleaved but safe; precedence graph is acyclic |
| VSR \ CSR | View serializable but NOT conflict serializable | Involves blind writes with semantically irrelevant orderings |
| All \ VSR | Non-serializable schedules | Produce results no serial schedule could; incorrect |
Our focus is on VSR \ CSR: those schedules that view serializability accepts but conflict serializability rejects.
The schedules in VSR \ CSR are theoretically correct (view equivalent to serial) but fail the conflict serializability test. They all share a common characteristic: they contain blind writes whose intermediate values are overwritten before being read. This is the only way for a schedule to be view serializable without being conflict serializable.
Let's briefly recap conflict serializability to enable precise comparison.
Conflict Definition:
Two operations conflict if:
Types of Conflicts:
Conflict Equivalence:
Two schedules S and S' are conflict equivalent if S' can be obtained from S by swapping non-conflicting adjacent operations.
Conflict Serializability:
A schedule S is conflict serializable if it is conflict equivalent to some serial schedule. Tested via precedence graph (acyclic = conflict serializable).
| Conflict Type | Operations | Why Order Matters |
|---|---|---|
| Read-Write (RW) | Rᵢ(X), Wⱼ(X) | Determines whether Tᵢ sees value before or after Tⱼ's write |
| Write-Read (WR) | Wᵢ(X), Rⱼ(X) | Determines whether Tⱼ sees Tᵢ's written value or earlier value |
| Write-Write (WW) | Wᵢ(X), Wⱼ(X) | Determines which value persists as final (or intermediate for reads) |
The Precedence Graph:
For a schedule S:
Key Property: Conflict serializability treats ALL conflicts as order-sensitive. If Wᵢ(X) precedes Wⱼ(X), this creates an edge Tᵢ → Tⱼ regardless of whether anyone reads between them. This is more conservative than necessary for semantic correctness.
Now let's recap view serializability with the same precision.
View Equivalence Conditions:
Two schedules S and S' are view equivalent (S ≡ᵥ S') if:
View Serializability:
A schedule S is view serializable if there exists a serial schedule S' such that S ≡ᵥ S'.
Key Property: View serializability cares about outcomes—what's read, what persists—not about the structural ordering of operations. If two writes to the same data item both get overwritten before any read, their relative order is semantically irrelevant.
Conflict serializability asks: 'Can we reorder non-conflicting operations to get a serial schedule?' View serializability asks: 'Does this schedule produce the same observable behavior as some serial schedule?' The second question is more fundamental but harder to answer efficiently.
Why View Serializability is More Permissive:
Conflict serializability considers ALL write-write conflicts as ordering constraints. But for view equivalence, a write-write conflict only matters if:
If a write is:
Then its position relative to other such writes is semantically irrelevant. View serializability recognizes this; conflict serializability does not.
| Aspect | Conflict Serializability (CSR) | View Serializability (VSR) |
|---|---|---|
| Definition Basis | Conflict equivalence (operation swaps) | View equivalence (semantic properties) |
| Equivalence Test | Can swap non-conflicting ops to get serial | Same reads, read-from, final writes as serial |
| Testing Algorithm | Precedence graph (O(n²)) | Check all n! serial schedules (NP-complete) |
| Set Relationship | Subset of VSR (CSR ⊂ VSR) | Superset of CSR (VSR ⊃ CSR) |
| Handles Blind Writes | Conservative (all WW conflicts matter) | Precise (irrelevant WW conflicts ignored) |
| Practical Use | Used in all real DBMS (via 2PL, etc.) | Theoretical importance only |
| Testing Complexity | Polynomial O(n²) | NP-complete |
Theorem: CSR ⊂ VSR (Proper Subset)
Proof:
Part 1: CSR ⊆ VSR (Every conflict serializable schedule is view serializable)
Let S be conflict serializable. Then S is conflict equivalent to some serial schedule S'. We show S ≡ᵥ S' (view equivalent):
Initial reads preserved: In transforming S to S', we only swap non-conflicting operations. Swapping doesn't change which reads occur before any writes (no R-W swap for the same item before that read). Initial reads are preserved.
Read-from preserved: If Tⱼ →X Tᵢ in S, then Wⱼ(X) precedes Rᵢ(X) with no intervening write to X. Swapping non-conflicting operations cannot change this relationship (any operation that could intervene would conflict with either Wⱼ(X) or Rᵢ(X)).
Final writes preserved: The last write Wᵢ(X) remains the last write after non-conflicting swaps. For another write Wⱼ(X) to become last, it would need to swap past Wᵢ(X), but Wⱼ(X) and Wᵢ(X) conflict—no swap possible.
Thus S ≡ᵥ S', so S is view serializable. ∎
Part 2: CSR ≠ VSR (There exist view serializable schedules that are not conflict serializable)
We've already seen the example with blind writes. This completes the proof that CSR ⊂ VSR (proper subset). ∎
We can precisely characterize when view serializability and conflict serializability differ.
Theorem: A schedule is in VSR \ CSR (view serializable but not conflict serializable) if and only if:
Proof Sketch:
(⟹) If S ∈ VSR \ CSR, then S has a WW conflict with reversed order between S and its equivalent serial schedule S'. This WW conflict involves writes where:
(⟸) If S has blind writes that are overwritten without being read, these writes can be reordered in a serial equivalent without affecting view equivalence, but the conflict equivalence would require preserving their order.
T₁: R₁(A), W₁(A)
T₂: W₂(A) ← blind write
T₃: W₃(A) ← blind write
Schedule S: R₁(A), W₂(A), W₁(A), W₃(A)View equivalent to T₁;T₂;T₃ (or T₁;T₃;T₂, etc.)T₂'s write is overwritten by T₁, T₁'s write is overwritten by T₃. No one reads T₂'s value. The WW conflict between W₂(A) and W₁(A) is semantically irrelevant.
Analysis of the Example:
Conflict Serializability Test:
Precedence Graph Edges:
Cycle detected: T₁ → T₂ → T₁ ⟹ Not conflict serializable
View Serializability Test:
In S:
Serial Schedule T₁; T₂; T₃:
S ≡ᵥ (T₁; T₂; T₃) ⟹ View serializable
The W₂(A) → W₁(A) conflict creates a cycle in the precedence graph, but it's semantically irrelevant: T₂'s value is never observed. View serializability recognizes this; conflict serializability treats it as a violation. This is the essence of the VSR \ CSR difference.
Given that view serializability accepts more schedules (potentially allowing more concurrency), why do real database systems use conflict serializability instead?
The answer is a fundamental tradeoff between theoretical permissiveness and practical feasibility.
| Factor | Conflict Serializability | View Serializability |
|---|---|---|
| Testing/detection | Fast (O(n²)) | Infeasible (NP-complete) |
| Protocol guarantee | 2PL, S2PL, timestamps | No efficient protocol known |
| Concurrency level | High (usually sufficient) | Slightly higher |
| Real-world usage | Universal (all DBMS) | Academic/theoretical only |
| Additional benefit | — | Rare edge cases only |
Database systems prioritize correctness, performance, and simplicity. Conflict serializability provides all three: guaranteed correctness, efficient enforcement (polynomial protocols), and simple implementation (locking). The marginal concurrency gain from VSR doesn't justify its computational cost.
An important observation: for many practical scenarios, conflict and view serializability are equivalent—any VSR schedule is also CSR.
Theorem: If a schedule contains no blind writes (every write is preceded by a read of the same item by the same transaction), then:
CSR = VSR
Proof Sketch:
We already know CSR ⊆ VSR. We need to show that without blind writes, VSR ⊆ CSR.
Without blind writes, every write Wᵢ(X) is preceded by Rᵢ(X). If S is view equivalent to serial S', then:
The lack of blind writes means WW conflict orders are determined by the corresponding RW/WR conflicts, leaving no room for VSR \ CSR schedules. ∎
Practical Implication:
In practice, most database applications use transactions with read-modify-write semantics:
-- Typical transaction pattern
BEGIN;
SELECT balance FROM accounts WHERE id = 123; -- Read
UPDATE accounts SET balance = balance + 100 WHERE id = 123; -- Write
COMMIT;
This pattern eliminates blind writes: the UPDATE is preceded by the SELECT. For such workloads, conflict serializability is not just a conservative approximation—it's equivalent to view serializability.
Blind writes typically occur in:
INSERT or UPDATE without prior read)These are relatively rare in traditional OLTP workloads.
We've comprehensively compared conflict serializability and view serializability. Let's consolidate the key insights:
What's Next:
Having compared view and conflict serializability, we'll now explore the computational complexity of testing view serializability in depth. Understanding why it's NP-complete illuminates fundamental limits of concurrency control and explains why practical systems avoid it.
You now deeply understand the relationship between conflict and view serializability. You can identify when they differ (blind writes), explain why conflict serializability is used in practice, and recognize when they coincide (read-modify-write patterns).