Open In App

View Serializability in DBMS

Prerequisite – Types of Schedules in DBMS 

The View serializability is a concept that is used to compute whether schedules are View-Serializable or not. A schedule is said to be View-Serializable if it is view equivalent to a Serial Schedule (where no interleaving of transactions is possible). 



Need of View-Serializability

There may be some schedules that are not Conflict-Serializable but still gives a consistent result because the concept of Conflict-Serializability becomes limited when the Precedence Graph of a schedule contains a loop/cycle. In such a case we cannot predict whether a schedule would be consistent or inconsistent. As per the concept of Conflict-Serializability, We can say that a schedule is Conflict-Serializable (means serial and consistent) if its corresponding precedence graph does not have any loop/cycle. 

But, what if a schedule’s precedence graph contains a cycle/loop and is giving consistent result/accurate results as a conflict serializable schedule is giving? 
 



So, to address such cases we brought the concept of View-Serializability because we did not want to confine the concept of serializability only to Conflict-Serializability. 

Example: Understanding View-Serializability first with a Schedule S1 : 

T1 T2 T3
a=100 
read(a) 
 
   
  a=a-40 
write(a) //60 
 
 
a=a-40 
write(a) //20 
 
   
    a=a-20 
write(a) //0 
 

So, its Conflict Precedence Graph is as follows – 
 

 

The above graph contains cycle/loop which means it is not conflict-serializable but it does not mean that it cannot be consistent and equivalent to the serial schedule it may or may not be. 
 

LookSchedule S’1 : 

In the above example if we do swapping among some transaction’s operation so our table will look like this – 

T1 T2 T3
a=100 
read(a) //100 
 
   
a=a-40 
write(a) //60 
 
   
  a=a-40 
write(a) //20 
 
 
    a=a-20 
write(a) //0 
 

Its Precedence Graph is as follows – 
 

 

Now, we see that the precedence graph of the second table does not contain any cycle/loop, which means it is conflict serializable (equivalent to serial schedule, consistent) and the final result is coming the same as the first table. 

Note: In the above example we understood that if a schedule is Conflict-serializable so we can easily predict that It would be –  

  1. Equivalent to a serial schedule,
  2. Consistent,
  3. And also a View-Serializable.

But what if it is non-conflict serializable (precedence graph contains loop). In this situation, we cannot predict whether it is consistent and serializable or not. As we look in the above example, where the precedence graph of Schedule S1 was giving consistent results, equivalent to the serializable result of Schedule S’1, despite containing cycles/loops. So, to address the limitation of the Conflict-Serializability concept View-Serializability method came into the picture. 

Method-1 : 
Two schedules S1 and S2 are said to be view-equivalent if the following conditions are agreed upon – Go to Link: Point number 3

Method-2 : 
First of all, check whether the given schedule is Non-Conflict Serializable or Conflict-Serializable – 

After performing the above steps if you find the provided schedule is non-conflicting you need to perform the following steps – 

Blind write: Performing the Writing operation (updation), without reading operation, a such write operation is known as a blind write. 

Problem: Prove whether the given schedule is View-Serializable or not. 

S' : read1(A), write2(A), read3(A), write1(A), write3(A)

Solution: First of all we’ll make a table for a better understanding of given transactions of schedule S’- 

T1 T2 T3
read(a)    
  write(a)  
    read(a)
write(a)    
    write(a)

Its Dependency graph will be followed as:
 

Fig. Precedence Graph

Fig. Dependence Graph

As there is no cycle/loop in the dependency graph, the schedule S’ is View-Serializable.


Article Tags :