DBMS slides 📂 Transactions and Concurrency · 3 of 5 35 min read

View Serializability in DBMS: Blind Writes, Examples and Solved Numericals

View serializability judges a schedule by its final result — same first read, same read-from, same last write — rather than by conflict order. This lets a few extra schedules through, always ones with blind writes overwritten before they're read. This tutorial covers the three view-equivalence rules, blind writes (with SQL examples), the class hierarchy, and three fully solved numericals including the classic VS-but-not-CS case.

View Serializability

The broader correctness class — where blind writes make schedules safe that the conflict test rejects. Same first read, same read-from, same last write: if the final "photo" matches a serial run, the schedule is view serializable.
View Equivalence Blind Writes VS ⊃ CS Solved Numericals

Press Next → or use ← → arrow keys

Section 01

The Story — The Whiteboard Photo

The boss only sees the final board
Three people scribble on a meeting-room whiteboard all afternoon, interleaving reads and writes chaotically. At 5 pm the cleaner photographs the board. If that chaotic session leaves the same final board as an orderly "one person at a time" session would, the two are view equivalent — the boss, holding only the photo, can't tell them apart.
📖
Definition

A schedule S is view serializable if it is view equivalent to some serial schedule of the same transactions. It's a result-based test — what matters is the final picture, not the exact conflict order.

Section 02

The Three Rules of View Equivalence

Two schedules are view equivalent iff all three hold for every data item:

👁️
1 · Initial read
The transaction that performs the first read of X must be the same in both schedules.
🔗
2 · Updated read
If Ti reads a value of X written by Tj, then in the other schedule Ti must read X from the same Tj (the read-from relationship).
🏁
3 · Final write
The transaction that performs the last write of X must be the same in both schedules.
🧠
The Memory Hook

"Same first read, same who-wrote-what-you-read, same last write." Agree on all three, for every item, and the two schedules are indistinguishable by result.

Section 03

Blind Writes — The Source of the Gap

🖊️
Definition

A blind write Wi(X) is a write of X by Ti that is not preceded by Ri(X) in the same transaction. Ti overwrites X without knowing its current value.

Transaction opsBlind?Reason
W(A)YESWrites A with no prior read
R(A), W(A)NOR(A) precedes W(A)
R(B), W(A)YESReading B doesn't inform W(A) — blindness is per item
W(A), R(A), W(A)YESFirst W(A) blind; second is informed by R(A)
W(A), W(A)YESBoth blind — an earlier write doesn't count as a "read"
🪤
Two Traps

Blindness is per item (reading B never informs W(A)) and per transaction (another transaction's read doesn't inform your write). When in doubt: "Did THIS transaction read THIS item before this Write?"

Section 03 · Industry

Blind Writes in Real SQL

SQL statementBlind?Why
INSERT INTO orders VALUES (…)YESInserts create new rows — no prior read possible
UPDATE accounts SET balance = 0 WHERE id = 7YESNew value doesn't depend on the old; no SELECT precedes it
UPDATE accounts SET balance = balance + 100 …NOThe right-hand side reads balance first — an implicit read
SELECT … FOR UPDATE then UPDATENOThe explicit SELECT supplies the prior read
DELETE FROM cache WHERE key = 'x'YESDELETE writes without needing to read first
🔑
The Golden Connection

Without blind writes, view serializability and conflict serializability are equivalent. Blind writes are the only source of the gap between the two classes.

Section 04

The Hierarchy of Schedule Classes

All schedules View serializable Conflict serializable Serial gap = blind writes
🪜
Serial ⊂ Conflict ⊂ View ⊂ All

Every conflict-serializable schedule is view serializable — but not vice versa. The thin ring between View and Conflict exists only because of blind writes: "useless" intermediate writes overwritten before anyone reads them.

Section 04 · Cost

Why Industry Skips View Serializability

ClassTest costWhat it catchesUsed in practice?
SerialO(1)Trivially safeToo slow
Conflict serializablePolynomialMost useful safe schedulesYes — 2PL, SSI
View serializableNP-completeA few extra with blind writesNo — theoretical
All schedules—Includes anomalous onesNot safe
🐌
The NP-Complete Wall

Testing view serializability is NP-complete — you may have to try all k! serial orders. Real engines never compute it; they use conflict serializability (2PL, SSI) and accept losing a few blind-write schedules.

Method

How to Check View Serializability

🧭 FOUR STEPS
1
Draw the precedence graph. Acyclic → conflict serializable → automatically view serializable. Done.
2
Cycle exists? Look for a blind write. No blind write → NOT view serializable. Stop.
3
Blind write present? Try each of the k! serial orders — check view equivalence with the three rules.
4
No serial order matches → NOT view serializable. (This step is NP-complete.)
⚡
Always Start With the Graph

If the precedence graph is acyclic you're finished — VS is free. Only a cycle forces you to hunt for blind writes and test serial orders.

Numerical 1

View Serializable — But NOT Conflict

S1: R1(A) W2(A) W1(A) W3(A)

TimeT1T2T3
t1R(A)
t2W(A)
t3W(A)
t4W(A)
T1 T2 T3 CYCLE
🔴
Conflict test fails

Edges on A: T1→T2 (RW), T2→T1 (WW), plus T2→T3, T1→T3. The cycle T1 ⇄ T2 → not conflict serializable.

🖊️
But blind writes exist

T2 and T3 write A with no prior read → both blind. So we test serial orders.

✅
T1 → T2 → T3 matches

First read = T1 ✓, no cross read-froms ✓, last write = T3 ✓. View serializable. W2(A) is overwritten by W3(A) and never read — its order is irrelevant.

Numerical 2

Neither View nor Conflict

S2: R1(A) R2(A) W1(A) W2(A) — the classic lost update

TimeT1T2
t1R(A)
t2R(A)
t3W(A)
t4W(A)
🔴
Cycle

R1(A) before W2(A) → T1→T2; R2(A) before W1(A) → T2→T1; W1 before W2 → T1→T2. Cycle T1 ⇄ T2.

🚫
No blind writes

Both T1 and T2 do R(A) then W(A) — neither is blind.

❌
NOT View Serializable — Stop Immediately

Cycle in the graph and no blind write → the verdict is final. No need to test any serial order. This is the classic lost-update anomaly.

Numerical 3

Blind Write Present — Yet Still Not VS

S3: R1(A) W2(A) R3(A) W1(A)

TimeT1T2T3
t1R(A)
t2W(A)
t3R(A)
t4W(A)

Preserve: initial read = T1 · T3 reads-from T2 · final write = T1.

🖊️
Cycle + one blind write

Edges give cycle T1 ⇄ T2; T2's W(A) is blind — so we must test serial orders.

🔎
Every order breaks a rule

T2→T3→T1: first read becomes T3 ✗. T1→T2→T3: first read T1 ✓, T3-from-T2 ✓, but last write becomes T2, not T1 ✗. All others fail too.

❌
NOT View Serializable

A blind write is necessary but not sufficient for "VS but not CS." Here no serial order preserves initial read and read-from and final write together.

Recap

The Three Numericals, Side by Side

#ScheduleCycle?Blind writes?Serial match?Verdict
1R1(A) W2(A) W1(A) W3(A)YesYes (T2, T3)Yes — T1→T2→T3✅ VS only
2R1(A) R2(A) W1(A) W2(A)YesNo—❌ Neither
3R1(A) W2(A) R3(A) W1(A)YesYes (T2)No❌ Neither
🎯
The Decision Path

Acyclic → VS. Cyclic + no blind write → not VS. Cyclic + blind write → test serial orders (may go either way). The exam's "VS but not CS" answer always hides a blind write overwritten before anyone reads it.

Head to Head

Conflict vs View Serializability

AspectConflict serializableView serializable
Based onConflict order (RW/WR/WW)Final result (the three rules)
TestPrecedence graph — polynomialTry serial orders — NP-complete
Class sizeSmaller (subset)Larger (superset)
Extra schedules—Ones with harmless blind writes
Used in real DBMSYes — 2PL, SSINo — teaching / theory
🧠
The Mental Model

Conflict serializability cares how you got there (the order of conflicts). View serializability cares only where you ended up (the final photo). Blind writes are what let the paths differ but the destination match.

Concept Check

Rapid-Fire Concept Check

QuestionAnswer
The three rules of view equivalenceInitial read · updated read · final write
A write with no prior read in that txnBlind write
Conflict serializable ⇒ view serializable?Yes (always)
View serializable ⇒ conflict serializable?Not necessarily
Without blind writes, VS = ?CS
Complexity of testing VSNP-complete
Cycle + no blind write → verdict?Not view serializable
Cycle + blind write → verdict?Test serial orders — may go either way
What real engines use insteadConflict serializability (2PL, SSI)
Golden Rules

Golden Rules of View Serializability

🏆 NON-NEGOTIABLE PRINCIPLES
1
View equivalent = agree on initial reads, updated reads (read-from), and final writes for every item.
2
Always start with the precedence graph. Acyclic → conflict serializable → view serializable is automatic.
3
Cycle + no blind write → NOT view serializable immediately. Don't test serial orders.
4
Blind writes are necessary but not sufficient for "VS but not CS" — a blind write only opens the door.
5
Testing VS is NP-complete — that's why no real DBMS uses it as a runtime correctness check.
6
The classic "VS-only" pattern: a blind write that's overwritten before anyone reads it, so its order never matters.
FINAL

Same Photo, Different Path

3View-equivalence rules
BlindThe gap-maker
VS ⊃ CSBroader class
NP-CWhy it's theory
🎯
The Whole Idea

View serializability judges a schedule by its final result — same first read, same read-from, same last write — not by conflict order. That lets a few extra schedules through, always ones with blind writes overwritten before they're read. It's a strictly broader class than conflict serializability, but NP-complete to test, so real engines stick with the precedence graph.

🧠
One Sentence to Remember

Acyclic graph? View serializable. Cyclic with no blind write? Not. Cyclic with a blind write? Test the serial orders — next stop: recoverability and the locking protocols that enforce all this live.

📸 End of tutorial · Press ← to review, or click Restart