View serializability in database
Consider two schedule S1 and S2. The schedule S1 and S2 are said to be view equivalent if they met the following three conditions. Such that the data item is A:
Condition 1:
If in schedule S1, transaction T1 reads the initial value of A, then in schedule S2 also transaction T2 must read the initial value of A.
Condition 2:
If in schedule S1 transaction T1 executes read(A), and that value was produced by transaction T2, then in schedule S2 also transaction T2 must read the value of A that was produced by the same write(A) operation of transaction T2.
Condition 3:
The transaction that performs the final write(A) operation in schedule S1 must also perform the final write(A) operation in schedule S2.
In schedule S1 transaction T1 read(A) and also in schedule S2 transaction T1 read(A). In two schedule they read the same initial value of A. So this two schedule fulfill the first condition of view serializability.
In schedule S1, T1 read(A) and produce value of A using write(A) operation and T2, read(A) used the previous value of A that was produced by write(A) operation. And also schedule S2 transaction T1 produce the value of A and T2 use it. So this two schedule fulfill the second condition.
In schedule S1, T1 read(A) and produce value of A using write(A) operation and T2, read(A) used the previous value of A that was produced by write(A) operation. And also schedule S2 transaction T1 produce the value of A and T2 use it. So this two schedule fulfill the second condition.
In schedule S1 transaction T2 write(B) is final operation and in schedule S2 it is also final write operation.
So we say that Schedule S1 and Schedule S2 are view serializable.
Important: Every conflict serializable schedule is also view serializable, but every view serializable schedule are not conflict serializable.
Comments
Post a Comment