DBMS View Serializability
DBMS View Serializability
We know that a serial schedule never leaves the database in inconsistent state
because there are no concurrent transactions execution.
However a non-serial schedule can leave the database in inconsistent state
because there are multiple transactions running concurrently.
By checking that a given non-serial schedule is view serializable, we make sure
that it is a consistent schedule.
Lets learn how to check whether the two schedules are view equivalent.
Two schedules T1 and T2 are said to be view equivalent, if they satisfy all the following conditions:
1. Initial Read: Initial read of each data item in transactions must match in both schedules.
For example, if transaction T1 reads a data item X before transaction T2 in schedule S1 then in schedule S2, T1 should read X
before T2.
Read vs Initial Read: You may be confused by the term initial read. Here initial read means the first read operation on a data item,
for example, a data item X can be read multiple times in a schedule but the first read operation on X is called the initial read. This
will be clearer once we get to the example in the next section of this article.
2. Final Write: Final write operations on each data item must match in both schedules.
For example, a data item X is last written by Transaction T1 in schedule S1 then in S2, the last write operation on X should be
performed by the transaction T1.
3. Update Read: If in schedule S1, the transaction T1 is reading a data item updated by T2 then in schedule S2, T1 should read the
value after the write operation of T2 on same data item.
For example, In schedule S1, T1 performs a read operation on X after the write operation on X by T2 then in S2, T1 should read
the X after T2 performs write on X.
View Serializable
Result: Since all the three conditions that checks whether the two schedules are view equivalent are satisfied in this example,
which means S1 and S2 are view equivalent. Also, as we know that the schedule S2 is the serial schedule of S1, thus we can say
that the schedule S1 is view serializable schedule.