Published by: Sareena Kumari Basnet
Published date: 28 Jul 2024
Serializability in DBMS refers to the concept of executing transactions in such a way that the output is the same as if the transactions were completed serially, one after the other, with no overlap. It is an important criterion for determining the accuracy of concurrent transactions.
There are two types of Serializability-
1) Conflict Serializability
Conflict Serializability is one of the type of Serializability, which can be used to check whether a non-serial schedule is conflict serializable or not. A schedule is called conflict serializable if we can convert it into a serial schedule after swapping its non-conflicting operations.
Conflicting operations
Two operations are said to be in conflict, if they satisfy all the following three conditions:
Let's consider this schedule:
To convert this schedule into a serial schedule we must have to swap the R(A) operation of transaction T2 with the W(A) operation of transaction T1.
However, we cannot swap these two operations because they are conflicting operations, thus we can say that this given schedule is not Conflict Serializable.
Example:
Schedule S2 is a serial schedule because, in this, all operations of T1 are performed before starting any operation of T2. Schedule S1 can be transformed into a serial schedule by swapping non-conflicting operations of S1.
After swapping of non-conflict operations, the schedule S1 becomes:
Since, S1 is conflict serializable.
Two schedules S1 and S2 are said to be view equivalent if they satisfy the following conditions:
An initial read of both schedules must be the same. Suppose two schedule S1 and S2. In schedule S1, if a transaction T1 is reading the data item A, then in S2, transaction T1 should also read A.
Above two schedules are view equivalent because Initial read operation in S1 is done by T1 and in S2 it is also done by T1.
2. Updated Read
In schedule S1, if Ti is reading A which is updated by Tj then in S2 also, Ti should read A which is updated by Tj.
Above two schedules are not view equal because, in S1, T3 is reading A updated by T2 and in S2, T3 is reading A updated by T1.
A final write must be the same between both the schedules. In schedule S1, if a transaction T1 updates A at last then in S2, final writes operations should also be done by T1.
Above two schedules is view equal because Final write operation in S1 is done by T3 and in S2, the final write operation is also done by T3.