0% found this document useful (0 votes)
157 views

Precedence Graph - DBMS

The document discusses precedence graphs which are used to test conflict serializability of a database schedule. It defines precedence graphs as directed graphs with transactions as nodes and edges representing conflicts. An algorithm is provided to construct the graph from a schedule and test for cycles to determine serializability.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views

Precedence Graph - DBMS

The document discusses precedence graphs which are used to test conflict serializability of a database schedule. It defines precedence graphs as directed graphs with transactions as nodes and edges representing conflicts. An algorithm is provided to construct the graph from a schedule and test for cycles to determine serializability.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

7/6/2021 Precedence Graph | DBMS

Home Coding problems DS & Algo. ▾ Languages ▾ Web. ▾ Programs ▾ Aptitude ▾ Interview ▾

Find Output ▾ MCQ ▾ CS Subjects ▾ More ▾

Home »
DBMS

Precedence Graph | DBMS


 
Ads by
Ad covered Not interested Seen this ad Ad was
content in this ad multiple times inappropriate
Stop seeing this ad Why this ad? 

DBMS precedence graph: In this tutorial, we are going to learn about the precedence graph and the
algorithm for testing conflict serializability of a schedule in the database management system.
Submitted by Anushree Goswami, on September 06, 2019

Precedence graph
A precedence graph, also known as serialization graph or conflict graph, is used for testing Conflict
Serializability of a schedule in the condition that forms the setting of concurrency control in databases.

It is also known as a directed Graph G = (V, E), which consists of a pair of a set of nodes V = {V1, V2, V3, ...,
Vn} and a set of directed edges E = {E1, E2, E3, ..., Em}. Where the set of nodes V are testing to retrieve
identical data attribute through the transactions of a schedule and the set of edges E is regulated connectivity
between a set of two nodes.

https://www.includehelp.com/dbms/precedence-graph.aspx 1/7
7/6/2021 Precedence Graph | DBMS

Nodes: In the graph, for each transaction Tp the graph contains a single node. So, In a schedule of a
precedence graph, The total number of transactions will be similar to the total number of nodes.

Edges: An edge is regulated connectivity between a set of two distinct transactions Tq and Tr and it shows in the
format Tq –>Tr, where Tq is the beginning of the edge and Tr is the ending.

The Algorithm for testing Conflict Serializability of a schedule


1. Create a node T, for each transaction participating in schedule S in the precedence graph.
2. For every condition in schedule S create an edge Tp → Tq in the precedence graph if a Transaction Tq
implements a read_item (Z) after Tp implements a write_item (Z). It's a Read-Write conflict.
3. For every condition in schedule S create an edge Tp → Tq in the precedence graph if a Transaction Tq
implements a write_item (Z) after Ti implements a read_item (Z). It's a Write-Read conflict.
4. For every condition in schedule S create an edge Tp → Tq in the precedence graph If a Transaction Tq
implements a write_item (Z) after Tp implements a write_item (Z). It's a Write-Write conflict.
5. If and only if there is no cycle in the precedence graph, then the schedule S is Serializable.

Example:

Q1) Find the following Schedule S is conflict Serializable or not?

https://www.includehelp.com/dbms/precedence-graph.aspx 2/7
7/6/2021 Precedence Graph | DBMS

Solution:

Let's make a precedence graph,

In the above precedence graph, by following accordingly to the Algorithm, Transaction Tp implements reads A
before Transaction Tq implements writes A, therefore the first arrow directed from Transaction Tp towards
Transaction Tq and Transaction Tq reads B before Transaction Tp writes B, therefore the second arrow directed
from Transaction Tq towards Transaction Tp.

Since from the above precedence graph it's clearly visible that the graph is cyclic, therefore the schedule S is not
conflicted Serializable.

Q2) Find the following Schedule S is conflict Serializable or not?

https://www.includehelp.com/dbms/precedence-graph.aspx 3/7
7/6/2021 Precedence Graph | DBMS

Solution:

Let's make a precedence graph,

https://www.includehelp.com/dbms/precedence-graph.aspx 4/7
7/6/2021 Precedence Graph | DBMS

In the above precedence graph, by following accordingly to the Algorithm, Transaction Tp implements reads A
before Transaction Tq implements writes A, therefore the first arrow directed.

from Transaction Tp towards Transaction Tq and Transaction Tq reads B before Transaction Tr writes B, therefore
the second arrow directed from Transaction Tq towards Transaction Tr and then the Transaction Tp reads C
before Transaction Tr writes C, therefore the third arrow directed from Transaction Tp towards Tr.

Since from the above precedence graph it's clearly visible that the graph is acyclic, therefore the schedule S is
conflict Serializable.

ADVERTISEMENT

TOP Interview Coding Problems/Challenges

Run-length encoding (find/print frequency of letters in a string)


Sort an array of 0's, 1's and 2's in linear time complexity
Checking Anagrams (check whether two string is anagrams or not)
Relative sorting algorithm
Finding subarray with given sum
Find the level in a binary tree with given sum K
Check whether a Binary Tree is BST (Binary Search Tree) or not
1[0]1 Pattern Count
Capitalize first and last letter of each word in a line
Print vertical sum of a binary tree
Print Boundary Sum of a Binary Tree
Reverse a single linked list
Greedy Strategy to solve major algorithm problems
Job sequencing problem
Root to leaf Path Sum
https://www.includehelp.com/dbms/precedence-graph.aspx 5/7
7/6/2021 Precedence Graph | DBMS

Exit Point in a Matrix


Find length of loop in a linked list
Toppers of Class
Print All Nodes that don't have Sibling
Transform to Sum Tree
Shortest Source to Destination Path

ADVERTISEMENT

Compare related
Transaction in
DBMS | Data
Keys in Relational

genomes - identify
Database
Replication and its
DBMS, Foreign

common features Management… Types Keys,Primary Kesy,…

Ad macvector.com includehelp.com includehelp.com includehelp.com

Data Preprocessing
Representation of a
Explain the E-R
Head start to create

in Data Mining Graph in Data


Model in RDBMS an Express.js project

Structure - IncludeHelp
includehelp.com includehelp.com includehelp.com includehelp.com

Comments and Discussions

Load comments

ADVERTISEMENT

https://www.includehelp.com/dbms/precedence-graph.aspx 6/7
7/6/2021 Precedence Graph | DBMS

Languages:
» C
» C++
» C++ STL
» Java
» Data Structure
» C#.Net
» Android
» Kotlin
» SQL

Web Technologies:
» PHP
» Python
» JavaScript
» CSS
» Ajax
» Node.js
» Web programming/HTML

Solved programs:
» C
» C++
» DS
» Java
» C#

Aptitude que. & ans.:


» C
» C++
» Java
» DBMS

Interview que. & ans.:


» C
» Embedded C
» Java
» SEO
» HR

CS Subjects:
» CS Basics
» O.S.
» Networks
» DBMS
» Embedded Systems
» Cloud Computing
» Machine learning
» CS Organizations
» Linux
» DOS

More:
» Articles
» Puzzles
» News/Updates

ABOUT SECTION
» About us
» Contact us
» Feedback
» Privacy policy

STUDENT'S SECTION
» Internship
» Certificates
» Content Writers of the Month

SUBSCRIBE
» Facebook
» LinkedIn
» Subscribe through email

© https://www.includehelp.com some rights reserved.

https://www.includehelp.com/dbms/precedence-graph.aspx 7/7

You might also like