A precedence graph, also named conflict graph and
serializability
In concurrency control of databases,Philip A. Bernstein, Vassos Hadzilacos, Nathan Goodman (1987)''Concurrency Control and Recovery in Database Systems''(free PDF download), Addison Wesley Publishing Company, Gerhard Weikum, Gottfried Vossen (200 ...
graph, is used in the context of
concurrency control
In information technology and computer science, especially in the fields of computer programming, operating systems, multiprocessors, and databases, concurrency control ensures that correct results for concurrent operations are generated, while ...
in
database
In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases spa ...
s.
The precedence graph for a schedule S contains:
* A node for each committed transaction in S
* An arc from T
i to T
j if an action of T
i precedes and
conflicts with one of T
j's actions. That is the actions belong to different transactions, at least one of the actions is a write operation, and the actions access the same object (read or write).
Precedence graph examples
Example 1

:
Example 2
:
A precedence graph of the schedule D, with 3 transactions. As there is a cycle (of length 2; with two edges) through the committed transactions T1 and T2, this
schedule
A schedule or a timetable, as a basic time-management tool, consists of a list of times at which possible tasks, events, or actions are intended to take place, or of a sequence of events in the chronological order in which such things are ...
(history) is ''not''
Conflict serializable.
Notice, that the commit of Transaction 2 does not have any meaning regarding the creation of a precedence graph.
Testing Serializability with Precedence Graph

Algorithm to test ''Conflict Serializability'' of a Schedule S along with an example schedule.
:or
# For each transaction T
x participating in schedule S, create a node labeled T
i in the precedence graph. Thus the precedence graph contains T
1, T
2, T
3.
# For each case in S where T
j executes a ''read_item''(X) after T
i executes a ''write_item''(X), create an edge (T
i → T
j) in the precedence graph. This occurs nowhere in the above example, as there is no read after write.
# For each case in S where T
j executes a ''write_item''(X) after T
i executes a ''read_item''(X), create an edge (T
i → T
j) in the precedence graph. This results in a directed edge from T
1 to T
2 (as T
1 has ''R(A)'' before T
2 having ''W(A)'').
# For each case in S where T
j executes a ''write_item''(X) after T
i executes a ''write_item''(X), create an edge (T
i → T
j) in the precedence graph. This results in directed edges from T
2 to T
1, T
2 to T
3 and T
1 to T
3.
# The schedule S is serializable if and only if the precedence graph has no cycles. As T
1 and T
2 constitute a cycle, the above example is not (conflict) serializable.
References
{{Reflist
External links
The Fundamentals of Database Systems, 5th Editionthe use of precedence graphs is discussed in chapter 17, as they relate to tests for
conflict serializability.
*
Abraham Silberschatz
Avi Silberschatz (born in Haifa, Israel) is an Israeli computer scientist and researcher. He graduated in 1976 with a Ph.D. in Computer Science from the State University of New York (SUNY) at Stony Brook. He became the Sidney J. Weinberg Profe ...
,
Henry Korth, and S. Sudarshan. 2005. Database System Concepts (5 ed.), PP. 628–630. McGraw-Hill, Inc., New York, NY, USA.
Database management systems
el:Γράφος Σειριοποιησιμότητας
ru:Граф предшествования