Thomas Write Rule in DBMS
Last Updated : 16 Jun, 2025
In a DBMS, transactions follow certain rules to ensure data consistency and correctness. When a user executes a command that modifies the database, the DBMS must ensure that the change are persistent. This ensures consistency & durability. One such rule is the Thomas Write Rule, which is an improvement over the Basic Timestamp Ordering Protocol.
In the Timestamp Ordering Protocol, if a transaction tries to write outdated data, it is usually rejected and rolled back to maintain serializability. However, not all outdated writes cause conflicts, and some can be safely ignored without affecting correctness. Thomas Write Rule allows such harmless outdated writes to be ignored instead of rolling back the transaction, increasing concurrency. It ensures view serializability
Key Conditions
The Thomas Write Rule modifies the Basic Timestamp Ordering Protocol by allowing certain outdated writes instead of rolling back transactions. It follows these three conditions when handling write operations (W_item(X)):
- Abort Condition (Reject the Transaction): If R_TS(X) > TS(T) (i.e., the read timestamp of X is greater than the timestamp of transaction T), Abort and rollback transaction T, as a newer version of X has already been read, and writing an outdated value could lead to inconsistency.
- Ignore Outdated Writes (Allow Execution Without Writing): If W_TS(X) > TS(T) (i.e., the write timestamp of X is greater than T’s timestamp), Ignore the write operation but continue processing the transaction.
- Execute Write Operation (Normal Execution): If neither condition (Abort or Ignore) occurs, then:
- Perform W_item(X) (write operation).
- Update W_TS(X) = TS(T) to reflect the latest write timestamp.
Outdated Write
The main improvement in Thomas Write Rule is that it ignores obsolete (outdated) writes instead of rejecting transactions. This happens when a newer transaction has already updated a value, making the older transaction's write operation unnecessary.
Example:
Consider two transactions:
- T1 arrives after T2, meaning TS(T2) < TS(T1).
- This implies that the serial execution order must be:
T2 → T1 (T2 should execute before T1).
Schedule Execution:
Step | Operation | Description |
---|
1 | T2: W2(X) | T2 writes X (sets W_TS(X) = TS(T2)) |
2 | T1: W1(X) | T1 tries to write X (TS(T1) > W_TS(X)) |
3 | T1's write is ignored | Since T2 has already written X, T1’s write is obsolete and ignored instead of rollback |
- In Basic Timestamp Ordering, T1 would abort because its write is considered outdated.
- In Thomas Write Rule, outdated writes are ignored instead of rollback, allowing T1 to continue execution.
Consider the partial schedule given below:
Example of Outdated WriteObsolete Writes are hence ignored in this rule which is in accordance with the 2nd protocol. It seems to be more logical as users skip an unnecessary procedure of restarting the entire transaction. This protocol is just a modification to the Basic TO protocol.
T1 | T2 |
---|
R(A) | |
| W(A) |
| Commit |
W(A) | |
Commit | |
The above table is showing a Serializable Schedule that is not a Conflict Serializable.
T1 | T2 |
---|
R(A) | Commit |
W(A) | |
Commit | |
The above table is showing a Conflict Serializable Schedule.
Features of Thomas Write Rule
The Thomas Write Rule, also known as the Write-Ahead Logging (WAL) protocol, has several key features that make it an important principle of database management systems:
- Durability: The Thomas Write Rule ensures that any modifications to the database are permanently saved to disk before the transaction is considered complete. This means that even in the event of a system failure or crash, the database can be recovered to a consistent state.
- Atomicity: The Thomas Write Rule is part of a larger principle of atomicity, which states that a transaction must either be complete in its entirety or be completely rolled back in the event of an error. By ensuring that modifications to the database are written to disk before a transaction is considered complete, the Thomas Write Rule helps to enforce atomicity.
- Concurrent Access: The Thomas Write Rule allows multiple users to access the database concurrently, while still ensuring that the database remains consistent and durable. This is accomplished through a variety of mechanisms, such as locking and transaction isolation levels.
- Performance: While the Thomas Write Rule does require that changes be written to disk before control is returned to the user, modern database systems are able to optimize the process to minimize the impact on performance. For example, many systems use a technique called "write-ahead logging" to batch changes together and write them to disk in an efficient manner.
Difference Between Basic TO Protocol and Thomas Write Rule
When comparing the Basic Timestamp Ordering (Basic TO) Protocol and the Thomas Write Rule, the key difference lies in how they handle outdated operations based on transaction timestamps.
Basic Timestamp Ordering (Basic TO)
- Checks every read/write operation against the timestamps of conflicting operations.
- If an operation violates the timestamp order, the transaction is immediately rolled back.
- Example: If T2 tries to write a value that has already been written by T1 (a later transaction), it is not allowed.
- Ensures conflict serializability.
- Results in frequent rollbacks, even if the outdated operation would not affect final results.
Thomas Write Rule (TWR)
- Based on the same timestamp mechanism as Basic TO.
- Introduces relaxation by allowing certain outdated writes to be ignored.
- If a write from an older transaction is superseded by a newer write, it is ignored instead of causing rollback.
- Improves concurrency and reduces aborts.
- Maintains view serializability, which is less strict but still correct.
Basic TO Protocol | Thomas Write Rule |
---|
- Not Allowed
- R1(X) W2(X)
- W1(X) R2(X)
- W1(X) W2(X)
- Allowed
- All operations where T2 occurs before T1.
- R1(X) R2(X)
| - Not Allowed
- Allowed
- All operations where T2 occurs before T1.
- Outdated Writes: W1(X) W2(X)
- R1(X) R2(X)
|
FAQs on Thomas Write Rule in DBMS
What is the Thomas Write Rule in DBMS?
The Thomas Write Rule is a modification of the Basic Timestamp Ordering Protocol that ignores outdated writes instead of rejecting transactions. It improves concurrency by allowing view serializable schedules even if they are not conflict serializable.
How does the Thomas Write Rule improve concurrency?
Instead of aborting transactions with outdated writes, it ignores those writes and allows the transaction to continue. This prevents unnecessary rollbacks and increases the number of concurrent transactions that can be processed.
What are the three main conditions of the Thomas Write Rule?
- Abort if an outdated read occurs → If a transaction reads an already updated value, it must be aborted.
- Ignore outdated writes → If a transaction tries to write an old value that has already been updated, the write is ignored.
- Execute only valid writes → If neither of the above conditions applies, the write is executed normally, and the write timestamp is updated.
How does the Thomas Write Rule differ from Basic Timestamp Ordering Protocol?
- Basic Timestamp Ordering: Rejects all outdated writes and forces a rollback.
- Thomas Write Rule: Ignores outdated writes but still maintains database consistency.
Is the Thomas Write Rule always conflict serializable?
No, Thomas Write Rule does not enforce Conflict Serializability but ensures View Serializability. This means some schedules that are not conflict serializable can still be allowed under Thomas Write Rule while maintaining correctness.
Similar Reads
Inner Join vs Outer Join Inner Join and Outer Join are the types of join. The inner join has the work to return the common rows between the two tables, whereas the Outer Join has the work of returning the work of the inner join in addition to the rows that are not matched. Let's discuss both of them in detail in this articl
9 min read
Having vs Where Clause in SQL In SQL, filtering data is important for extracting meaningful insights from large datasets. While both the WHERE and HAVING clauses allow us to filter data, they serve distinct purposes and operate at different stages of the query execution process. Understanding the difference between these clauses
4 min read
Concurrency Control in DBMS In a database management system (DBMS), allowing transactions to run concurrently has significant advantages, such as better system resource utilization and higher throughput. However, it is crucial that these transactions do not conflict with each other. The ultimate goal is to ensure that the data
7 min read
Database Recovery Techniques in DBMS Database Systems like any other computer system, are subject to failures but the data stored in them must be available as and when required. When a database fails it must possess the facilities for fast recovery. It must also have atomicity i.e. either transactions are completed successfully and com
11 min read
ACID Properties in DBMS In the world of DBMS, transactions are fundamental operations that allow us to modify and retrieve data. However, to ensure the integrity of a database, it is important that these transactions are executed in a way that maintains consistency, correctness, and reliability. This is where the ACID prop
8 min read
Why recovery is needed in DBMS Basically, whenever a transaction is submitted to a DBMS for execution, the operating system is responsible for making sure or to be confirmed that all the operations which need to be performed in the transaction have been completed successfully and their effect is either recorded in the database or
6 min read
Types of Schedules in DBMS Schedule, as the name suggests, is a process of lining the transactions and executing them one by one. When there are multiple transactions that are running in a concurrent manner and the order of operation is needed to be set so that the operations do not overlap each other, Scheduling is brought i
7 min read
Conflict Serializability in DBMS A schedule is a sequence in which operations (read, write, commit, abort) from multiple transactions are executed in a database. Serial or one by one execution of schedules has less resource utilization and low throughput. To improve it, two or more transactions are run concurrently. Conflict Serial
5 min read
Precedence Graph for Testing Conflict Serializability in DBMS A Precedence Graph or Serialization Graph is used commonly to test the Conflict Serializability of a schedule. It is a directed Graph (V, E) consisting of a set of nodes V = {T1, T2, T3..........Tn} and a set of directed edges E = {e1, e2, e3..................em}. The graph contains one node for eac
6 min read
Recoverability in DBMS Recoverability is a critical feature of database systems. It ensures that after a failure, the database returns to a consistent state by permanently saving committed transactions and rolling back uncommitted ones. It relies on transaction logs to undo or redo changes as needed. This is crucial in mu
6 min read