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

View Equivalent Schedule in DBMS

The document discusses view equivalent schedules and view serializable schedules in database transactions. It provides three conditions for two schedules to be considered view equivalent: 1) initial reads must be from the initial database, 2) updated reads must be of the same data item updated by another transaction, and 3) final writes of a data item must be by the same transaction. It then gives examples of checking if a schedule is view serializable by first determining if it is conflict serializable, and if not, checking for blind writes.

Uploaded by

Daison Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
302 views

View Equivalent Schedule in DBMS

The document discusses view equivalent schedules and view serializable schedules in database transactions. It provides three conditions for two schedules to be considered view equivalent: 1) initial reads must be from the initial database, 2) updated reads must be of the same data item updated by another transaction, and 3) final writes of a data item must be by the same transaction. It then gives examples of checking if a schedule is view serializable by first determining if it is conflict serializable, and if not, checking for blind writes.

Uploaded by

Daison Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

View Equivalent Schedules

A Schedule is called view Equivalent serializable if it is view equal


to a serial schedule (no overlapping transactions).

View Equivalent Schedules


 
Consider two schedules S1 and S2 each consisting of two
transactions T1 and T2.
Schedules S1 and S2 are called view equivalent if the following
three conditions hold true for them,
1) Initial Read
2) Updated Read (Producer-Consumer Problem)
3) Final Write operation
Example: View Equivalent Serializability in DBMS Transactions
1) Initial Read
If a transaction T1 reading data item A from initial database in S1 then
in S2 also T1 should read A from initial database.
2)Updated Read (Producer-Consumer Problem)
If transaction T1 reads a data item that has been updated by the
transaction T2 in schedule S1, then in schedule S2 also, transaction T1 must
read the same data item that has been updated by the transaction T2.
3)Final Write operation
For each data item X, if X has been updated at last by transaction T1 in
schedule S1, then in schedule S2 also, X must be updated at last by transaction T1.
Schedules S1 and S2 are called view equivalent, it satisfies the following three
conditions hold true for them,
1) Initial Read
2) Updated Read (Producer-Consumer Problem)
3) Final Write operation

Therefore,
The Schedule S1 and S2 are called View Equivalent serializable if it is
view equal to a serial schedule (no overlapping transactions).
View Serializable:

A conflict schedule is a view serializable but if the serializability


contains blind writes, then the view serializable does not conflict
serializable.
Checking Whether a Schedule is View Serializable Or Not?
Checking Whether a Schedule is View Serializable Or Not?
Checking Whether a Schedule is View Serializable Or Not?
Problems Based on View Serializability- Problem-01

Check whether the given schedule S is view serializable or


not?
Solution-
if a schedule is conflict serializable, then it is
surely view serializable.
So, let us check whether the given schedule is conflict
serializable or not.

Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
W1(B) , W2(B)              (T1 → T2)
W1(B) , W3(B)              (T1 → T3)
W1(B) , W4(B)              (T1 → T4)
W2(B) , W3(B)              (T2 → T3)
W2(B) , W4(B)              (T2 → T4)
W3(B) , W4(B)              (T3 → T4)
Problems Based on View Serializability- Problem-01

Check whether the given schedule S is view serializable or


not?
Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
W1(B) , W2(B)              (T1 → T2)
W1(B) , W3(B)              (T1 → T3)
W1(B) , W4(B)              (T1 → T4)
W2(B) , W3(B)              (T2 → T3)
W2(B) , W4(B)              (T2 → T4)
W3(B) , W4(B)              (T3 → T4)
Step-02:
Draw the precedence graph

Clearly,
there exists no cycle in the precedence graph.
Therefore, the given schedule S is conflict serializable.
Thus, we conclude that the given schedule is also view
serializable.
Problems Based on View Serializability- Problem-02

Check whether the given schedule S is view serializable or


not?
Solution-
if a schedule is conflict serializable, then it is
surely view serializable.
So, let us check whether the given schedule is conflict
serializable or not.

Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
R1(A) , W3(A)              (T1 → T3)
R2(A) , W3(A)              (T2 → T3)
R2(A) , W1(A)              (T2 → T1)
W3(A) , W1(A)             (T3 → T1)
Problems Based on View Serializability- Problem-02

Check whether the given schedule S is view serializable or


not?
Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
R1(A) , W3(A)              (T1 → T3)
R2(A) , W3(A)              (T2 → T3)
R2(A) , W1(A)              (T2 → T1)
W3(A) , W1(A)             (T3 → T1)
Step-02:
Draw the precedence graph Clearly, there exists a cycle in the precedence graph.
Therefore, the given schedule S is not conflict serializable.

Now,
• Since, the given schedule S is not conflict serializable,
so, it may or may not be view serializable.
• To check whether S is view serializable or not, let us
use another method.
• Let us check for blind writes.
Problems Based on View Serializability- Problem-02

Check whether the given schedule S is view serializable or


not?

Checking for Blind Writes (Without Read operation Directly doing Write Operation)
 
There exists a blind write W3 (A) in the given schedule S.
Therefore, the given schedule S may or may not be view serializable.
 
Now,
• To check whether S is view serializable or not, let us use another method.
• Let us derive the dependencies and then draw a dependency graph (or) Poly graph.
Problems Based on View Serializability- Problem-02

Check whether the given schedule S is view serializable or


not?
Drawing a Dependency Graph
 
• T1 firstly reads A and T3 firstly updates A.
• So, T1 must execute before T3.
• Thus, we get the dependency T1 → T3.
• Final updation on A is made by the transaction T1.
• So, T1 must execute after all other transactions.
• Thus, we get the dependency (T2, T3) → T1.
• There exists no write-read sequence.

Now, let us draw a dependency graph using these


dependencies

Clearly,
• there exists a cycle in the dependency graph.
• Thus, we conclude that the given schedule S is not view
serializable.
Problems Based on View Serializability- Problem-03

Check whether the given schedule S is view serializable or


not?
Solution-
if a schedule is conflict serializable, then it is
surely view serializable.
So, let us check whether the given schedule is conflict
serializable or not.

Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
R1(A) , W2(A)              (T1 → T2)
R2(A) , W1(A)              (T2 → T1)
W1(A) , W2(A)             (T1 → T2)
R1(B) , W2(B)              (T1 → T2)
R2(B) , W1(B)              (T2 → T1)
Problems Based on View Serializability- Problem-03

Check whether the given schedule S is view serializable or


not?
Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
R1(A) , W2(A)              (T1 → T2)
R2(A) , W1(A)              (T2 → T1)
W1(A) , W2(A)             (T1 → T2)
R1(B) , W2(B)              (T1 → T2)
R2(B) , W1(B)              (T2 → T1)
Clearly, there exists a cycle in the precedence graph.
Step-02: Therefore, the given schedule S is not conflict serializable.
Draw the precedence graph
Now,
• Since, the given schedule S is not conflict serializable,
so, it may or may not be view serializable.
• To check whether S is view serializable or not, let us
use another method.
• Let us check for blind writes.
Problems Based on View Serializability- Problem-03

Check whether the given schedule S is view serializable or


not?

Checking for Blind Writes (Without Read operation


Directly doing Write Operation)
 
Here exists no blind write in the given schedule S.
Therefore, it is surely not view serializable.
 
Alternatively,
• You could directly declare that the given schedule S is not view serializable.
• This is because there exists no blind write in the schedule.
• You need not check for conflict serializability.
Problems Based on View Serializability- Problem-04

Check whether the given schedule S is view serializable or


not? S : R1(A) , W2(A) , R3(A) , W1(A) , W3(A)

Solution-
if a schedule is conflict serializable, then it is
surely view serializable.
So, let us check whether the given schedule is conflict
serializable or not.

Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
R1(A) , W2(A)              (T1 → T2)
R1(A) , W3(A)              (T1 → T3)
W2(A) , R3(A)              (T2 → T3)
W2(A) , W1(A)             (T2 → T1)
W2(A) , W3(A)             (T2 → T3)
R3(A) , W1(A)              (T3 → T1)
W1(A) , W3(A)             (T1 → T3)
Problems Based on View Serializability- Problem-04

Check whether the given schedule S is view serializable or


not? S : R1(A) , W2(A) , R3(A) , W1(A) , W3(A)

Step-01:
  List all the conflicting operations and
determine the dependency between the transactions.
R1(A) , W2(A)              (T1 → T2)
R1(A) , W3(A)              (T1 → T3)
W2(A) , R3(A)              (T2 → T3)
W2(A) , W1(A)             (T2 → T1)
W2(A) , W3(A)             (T2 → T3)
R3(A) , W1(A)              (T3 → T1)
W1(A) , W3(A)             (T1 → T3)
Step-02: Clearly, there exists a cycle in the precedence graph.
Draw the precedence graph Therefore, the given schedule S is not conflict serializable.
Now,
• Since, the given schedule S is not conflict serializable,
so, it may or may not be view serializable.
• To check whether S is view serializable or not, let us
use another method.
• Let us check for blind writes.
Problems Based on View Serializability- Problem-04

Check whether the given schedule S is view serializable or


not?

Checking for Blind Writes (Without Read operation Directly doing Write Operation)
 
There exists a blind write W2 (A) in the given schedule S.
Therefore, the given schedule S may or may not be view serializable.
 
Now,
• To check whether S is view serializable or not, let us use another method.
• Let us derive the dependencies and then draw a dependency graph.
Problems Based on View Serializability- Problem-04

Check whether the given schedule S is view serializable or


not?
Drawing a Dependency Graph
 
• T1 firstly reads A and T2 firstly updates A.
• So, T1 must execute before T2.
• Thus, we get the dependency T1 → T2.
• Final updation on A is made by the transaction T3.
• So, T3 must execute after all other transactions.
• Thus, we get the dependency (T1, T2) → T3.
• From write-read sequence, we get  the dependency T2 → T3

Now, let us draw a dependency graph using these dependencies

Clearly,
• There exists no cycle in the dependency graph.
• Therefore, the given schedule S is view serializable.
• The serialization order T1 → T2 → T3.

You might also like