How Databases Safely Ignore Obsolete Writes: Thomas Write Rule Explained
In distributed databases and concurrency control, standard locking mechanisms (like 2PL) can cause painful deadlock cycles and lock contention.
To solve this, database engines use Timestamp Ordering (TSO): transactions execute lock-free, ordered by logical timestamps TS(T).
⚡ The Standard Timestamp Ordering Conflict
For every data record Q, the database tracks two timestamps:
-
R-TS(Q): The largest timestamp of any transaction that readQ. -
W-TS(Q): The largest timestamp of any transaction that wrote toQ.
Under standard Timestamp Ordering, when an older transaction T₁ (TS = 10) attempts to execute write(Q) after a newer transaction T₂ (TS = 20) has already updated Q:
Time ────────────────────────────────────────────────────────► T1 (TS = 10) ──── attempts write(Q) ───► 💥 CONFLICT! T2 (TS = 20) ──── already executed write(Q) [W-TS(Q) = 20] Standard TSO says:
"You are an older transaction attempting to overwrite a newer value. Abort and rollback T₁!"
Rolling back transactions wastes CPU cycles, bandwidth, and increases user latency.
🧠 The Thomas Write Rule Breakthrough
In 1979, Robert H. Thomas realized that under one specific condition, aborting T₁ is completely unnecessary:
IF: TS(T) < W-TS(Q) (A newer transaction already wrote Q) AND: TS(T) >= R-TS(Q) (No transaction with TS > TS(T) has read Q!) THEN: DO NOT ABORT T. SIMPLY IGNORE / DISCARD THE WRITE! Why Can We Safely Ignore the Write?
- The value that
T₁wanted to write was destined to be immediately overwritten byT₂anyway. - Because no intermediate transaction ever read
T₁'s value, skippingT₁'s write produces the exact same final database state as ifT₁had executed first! -
T₁continues executing without incurring a costly rollback.
🚀 View Serializability vs Conflict Serializability
Thomas Write Rule is famous in database theory because it generates schedules that are View Serializable but NOT Conflict Serializable:
Schedule S: T1: read(A) write(A) (ignored!) T2: write(A) ────────────────────────────────────────────────────────► Result: Valid view-equivalent schedule without aborting T1! 🛠️ Step Through the Live Simulator
Want to inspect timestamp comparisons, simulate out-of-order writes, and test Thomas Write Rule interactively?
👉 Step through the interactive concurrency schedule simulator on Binary Dose.


