# Check if the given schedules are view serializable(DBMS)

A schedule has view-serializability if it is view equivalent to a serial schedule. A schedule is view serializable if the following three rules are satisfied −

• Rule 1 − If Ti reads data initially, after this Tj writes the same data, in the given schedule. This sequence must be followed in the transaction combination (read write operation).

• Rule 2 − If Ti writes data initially, after this Tj reads the same data, in the given schedule. This sequence must be followed in the transaction combination (write read operation).

• Rule 3 − If Ti writes data, after this Tj writes the data finally. This sequence must be followed in the transaction combination (write-write operation).

## Problem

Check the view serializability for the schedules R1(X), R2(Y), R2(Y), W2(X), W3(Y), R1(Y).

## Solution

Create all possible combinations of the transactions, we have three transactions, so the combinations are as follows −

<T1, T2, T3>

<T1, T3, T2>

<T2, T1, T3>

<T2, T3, T1>

<T3, T1, T2>

<T3, T2, T1>

Rule 1 − T1 reads initially after this T2 writes the same data that means transaction sequence must be “T1 followed byT2” so, remove following combinations where “T1 is not followed by T2” that is T2 occur before T1 has to be removed.

<T2, T1, T3>

<T2, T3, T1>

<T3, T2, T1>

Rule 2 − T2 writes data, after this T1 reads the same data X, that means transaction sequence must be “T2 followed by T1”, now this rule violates RULE 1, because of this none of the rules can be applied so, it is not view serializable.

Rule 3 − we will not check RULE 3 because we have concluded that schedule is not view serializable in RULE 2.

## Conclusion

The given schedule is not view serializable.