Testing of Serializability in DBMS
In a Database Management System (DBMS), multiple transactions may execute concurrently. Serializability is an important concept used to ensure that concurrent execution produces a result equivalent to some serial execution of the transactions.
One of the most common methods for testing serializability is the Precedence Graph, also known as the Serialization Graph.
Table of Contents

What is a Precedence Graph?
Complete Advance AI Topics: Click Here
SQL Tutorial: Click Here
A precedence graph is a directed graph used to determine whether a schedule is conflict serializable.
For a schedule S, the graph can be represented as:
G = (V, E)
- V (Vertices): Each vertex represents a transaction involved in the schedule.
- E (Edges): Each directed edge represents a dependency between two transactions.
An edge Ti → Tj is added when an operation of transaction Ti occurs before a conflicting operation of transaction Tj on the same data item.
Conflicting Operations
Two operations are considered conflicting when they:
- Belong to different transactions.
- Operate on the same data item.
- At least one of the operations is a write operation.
The three types of conflicts are:
| Conflict Type | Condition | Edge |
|---|---|---|
| Write-Read (WR) | Ti writes(Q) before Tj reads(Q) | Ti → Tj |
| Read-Write (RW) | Ti reads(Q) before Tj writes(Q) | Ti → Tj |
| Write-Write (WW) | Ti writes(Q) before Tj writes(Q) | Ti → Tj |
Steps to Test Serializability
- Identify all transactions present in the schedule.
- Create one vertex for each transaction.
- Find all conflicting operations involving the same data item.
- Add a directed edge from the transaction performing the earlier operation to the transaction performing the later operation.
- Check the resulting graph for cycles.
Rule for Testing Serializability
The most important rule is:
- Cycle in the precedence graph → Non-serializable schedule.
- No cycle in the precedence graph → Serializable schedule.
Therefore, detecting a cycle is enough to determine that a schedule is not conflict serializable.
Example of a Non-Serializable Schedule
Suppose the precedence graph contains the following edges:
- T2 → T3
- T3 → T1
- T1 → T2
These dependencies form the cycle:
T2 → T3 → T1 → T2
Since the graph contains a cycle, the schedule is not conflict serializable.
Example of a Serializable Schedule
Consider a precedence graph with the following dependencies:
- T1 → T2
- T2 → T3
There is no path that returns to an earlier transaction, so the graph is acyclic.
Therefore, the schedule is conflict serializable.
Why is Serializability Important?
Serializability helps maintain database consistency when multiple transactions execute at the same time. It ensures that concurrent execution behaves like a valid serial execution, reducing the risk of incorrect or inconsistent results.
It is especially important in systems where many users access and modify shared data concurrently.
YT:- DecodeIT
Conclusion
Testing serializability is an essential part of concurrency control in DBMS. A precedence graph provides a simple way to determine whether a schedule is conflict serializable.
Remember the key rule:
Cycle = Non-Serializable
No Cycle = Serializable
Understanding precedence graphs makes it easier to analyze transaction schedules and maintain consistency during concurrent execution.
Keywords
Testing of Serializability in DBMS, Serializability in DBMS, Precedence Graph, Serialization Graph, Conflict Serializability, Conflict Serializable Schedule, Transaction Scheduling, Concurrency Control, DBMS Transactions, Serializable Schedule