DBMS Topics
Timestamp-Based Protocol
Last Updated : 21 May, 2026
The Timestamp Ordering Protocol is an alternative to locking for concurrency control. Instead of using locks, each transaction is assigned a unique timestamp when it star
Overview
The Timestamp Ordering Protocol is an alternative to locking for concurrency control. Instead of using locks, each transaction is assigned a unique timestamp when it starts, and the protocol ensures that conflicting operations execute in timestamp order.
No locks → No deadlocks (a key advantage over 2PL).
Timestamps
Each transaction Ti is assigned a unique timestamp TS(Ti) when it begins:
- Typically the system clock or a logical counter
- Older transactions have smaller timestamps
- TS(Ti) < TS(Tj) means Ti started before Tj
Per Data Item Bookkeeping
For each data item X, the system maintains:
| Field | Description |
|---|---|
| R-timestamp(X) | Largest timestamp of any transaction that successfully read X |
| W-timestamp(X) | Largest timestamp of any transaction that successfully wrote X |
Timestamp Protocol Rules
Read Rule
Transaction Ti issues read(X):
Write Rule
Transaction Ti issues write(X):
Example
| Transactions | T1 (TS=1), T2 (TS=2) |
| Data items | X (R-ts=0, W-ts=0 initially) |
| Step 1 | T2 reads X |
| TS(T2)=2 ≥ W-ts(X)=0 | ALLOWED ✓ |
| Step 2 | T1 reads X |
| TS(T1)=1 ≥ W-ts(X)=0 | ALLOWED ✓ |
| Step 3 | T1 writes X |
| TS(T1)=1 < R-ts(X)=2 | REJECTED! ✗ |
| Step 4 | T2 writes X |
Thomas' Write Rule (Optimization)
The Thomas' Write Rule modifies the write rule to allow more concurrency:
This makes some non-conflict-serializable (but view-serializable) schedules acceptable.
Timestamp vs. 2PL Comparison
| Feature | 2PL | Timestamp Protocol |
|---|---|---|
| Mechanism | Locks | Timestamps |
| Deadlock | Possible | Not possible |
| Starvation | Possible | Possible (restarting) |
| Conflict Resolution | Block (wait) | Abort and restart |
| Overhead | Lock table | Timestamp per item |
| Serial order | Lock point order | Timestamp order |
Advantages and Disadvantages
Advantages
- No deadlocks — transactions never wait; they either proceed or restart
- Simple implementation (no lock table management)
- Guarantees serializability with order = timestamp order
Disadvantages
- High abort rate if many conflicting transactions restart repeatedly
- Starvation possible (a transaction keeps getting aborted by newer ones)
- Long-running transactions get aborted often (large gap between start and end)
Multiversion Timestamp Protocol
An extension that keeps multiple versions of each data item:
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Timestamp-Based Protocol.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this DBMS topic.
Search Terms
dbms, database management system, database notes, sql, unit, timestamp, protocol, timestamp-based protocol
Related DBMS Topics