Timestamp based Concurrency Control
Last Updated :
04 Jul, 2025
Timestamp-based concurrency control is a method used in database systems to ensure that transactions are executed safely and consistently without conflicts, even when multiple transactions are being processed simultaneously. This approach relies on timestamps to manage and coordinate the execution order of transactions. Refer to the timestamp of a transaction T as TS(T).
What is Timestamp Ordering Protocol?
The Timestamp Ordering Protocol is a method used in database systems to order transactions based on their timestamps. A timestamp is a unique identifier assigned to each transaction, typically determined using the system clock or a logical counter. Transactions are executed in the ascending order of their timestamps, ensuring that older transactions get higher priority.
For example:
- If Transaction T1 enters the system first, it gets a timestamp TS(T1) = 007 (assumption).
- If Transaction T2 enters after T1, it gets a timestamp TS(T2) = 009 (assumption).
This means T1 is "older" than T2 and T1 should execute before T2 to maintain consistency.
Key Features of Timestamp Ordering Protocol:
Transaction Priority:
- Older transactions (those with smaller timestamps) are given higher priority.
- For example, if transaction T1 has a timestamp of 007 times and transaction T2 has a timestamp of 009 times, T1 will execute first as it entered the system earlier.
Early Conflict Management:
- Unlike lock-based protocols, which manage conflicts during execution, timestamp-based protocols start managing conflicts as soon as a transaction is created.
Ensuring Serializability:
- The protocol ensures that the schedule of transactions is serializable. This means the transactions can be executed in an order that is logically equivalent to their timestamp order.
Basic Timestamp Ordering

Precedence Graph for TS ordering
The Basic Timestamp Ordering (TO) Protocol is a method in database systems that uses timestamps to manage the order of transactions. Each transaction is assigned a unique timestamp when it enters the system ensuring that all operations follow a specific order making the schedule conflict-serializable and deadlock-free.
- Suppose, if an old transaction Ti has timestamp TS(Ti), a new transaction Tj is assigned timestamp TS(Tj) such that TS(Ti) < TS(Tj).
- The protocol manages concurrent execution such that the timestamps determine the serializability order.
- The timestamp ordering protocol ensures that any conflicting read and write operations are executed in timestamp order.
- Whenever some Transaction T tries to issue a R_item(X) or a W_item(X), the Basic TO algorithm compares the timestamp of T with R_TS(X) & W_TS(X) to ensure that the Timestamp order is not violated.
This describes the Basic TO protocol in the following two cases:
Whenever a Transaction T issues a W_item(X) operation, check the following conditions:
- If R_TS(X) > TS(T) and if W_TS(X) > TS(T), then abort and rollback T and reject the operation. else,
- Execute W_item(X) operation of T and set W_TS(X) to TS(T) to the larger of TS(T) and current W_TS(X).
Whenever a Transaction T issues a R_item(X) operation, check the following conditions:
- If W_TS(X) > TS(T), then abort and reject T and reject the operation, else
- If W_TS(X) <= TS(T), then execute the R_item(X) operation of T and set R_TS(X) to the larger of TS(T) and current R_TS(X).
Whenever the Basic TO algorithm detects two conflicting operations that occur in an incorrect order, it rejects the latter of the two operations by aborting the Transaction that issued it.
Advantages of Basic TO Protocol
- Conflict Serializable: Ensures all conflicting operations follow the timestamp order.
- Deadlock-Free: Transactions do not wait for resources, preventing deadlocks.
- Strict Ordering: Operations are executed in a predefined, conflict-free order based on timestamps.
Drawbacks of Basic Timestamp Ordering (TO) Protocol
- Cascading Rollbacks : If a transaction is aborted, all dependent transactions must also be aborted, leading to inefficiency.
- Starvation of Newer Transactions : Older transactions are prioritized, which can delay or starve newer transactions.
- High Overhead: Maintaining and updating timestamps for every data item adds significant system overhead.
- Inefficient for High Concurrency: The strict ordering can reduce throughput in systems with many concurrent transactions.
Strict Timestamp Ordering
The Strict Timestamp Ordering Protocol is an enhanced version of the Basic Timestamp Ordering Protocol. It ensures a stricter control over the execution of transactions to avoid cascading rollbacks and maintain a more consistent schedule.
Key Features
- Strict Execution Order: Transactions must execute in the exact order of their timestamps. Operations are delayed if executing them would violate the timestamp order, ensuring a strict schedule.
- No Cascading Rollbacks: To avoid cascading aborts, a transaction must delay its operations until all conflicting operations of older transactions are either committed or aborted.
- Consistency and Serializability: The protocol ensures conflict-serializable schedules by following strict ordering rules based on transaction timestamps.
For Read Operations (R_item(X)):
- A transaction T can read a data item X only if: W_TS(X), the timestamp of the last transaction that wrote to X, is less than or equal to TS(T), the timestamp of T and the transaction that last wrote to X has committed.
- If these conditions are not met, T's read operation is delayed until they are satisfied.
For Write Operations (W_item(X)):
- A transaction T can write to a data item X only if: R_TS(X), the timestamp of the last transaction that read X, and W_TS(X), the timestamp of the last transaction that wrote to X, are both less than or equal to TS(T) and all transactions that previously read or wrote X have committed.
- If these conditions are not met, T's write operation is delayed until all conflicting transactions are resolved.
- GATE | GATE CS 2010 | Question 20
- GATE | GATE-CS-2017 (Set 1) | Question 46
- GATE | GATE-IT-2004 | Question 21
Similar Reads
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
Deadlock in DBMS In a Database Management System (DBMS), a deadlock occurs when two or more transactions are waiting indefinitely for one another to release resources (such as locks on tables, rows, or other database objects). This results in a situation where none of the transactions can proceed, effectively bringi
8 min read