Conflict Serializability in database

To maintains database state consistency we introduce serializability. Using serializability we can understand which schedule will ensure consistency, and which schedule will not. When we are capable of converting a concurrent schedule into a serial schedule then we cal it serializable schedule. A schedule is serializable if it is equivalent to a serial schedule. We divided this concepts into two parts
1. Conflict serializability  &
2. View serializability
In this discussion I just clarify you the conflict serializability.
Consider two instruction read, write and the data item A and B. When two instruction execute different data item such as read(A) and read(B), then we can swap the instruction without affecting the result of the schedule. But when the data item is equivalent to one another we need to consider following four condition.
   a.  read(A),   read(A).   they don’t conflict.
   b.  
read(Q),   write(Q).  They conflict.
   c.
 write(Q),  read(Q).   They conflict  
   d.  write(Q),  write(Q).   They conflict
When the two instruction don't conflict we can easily swap it otherwise we can't. As a result of swapping if we found a serial schedule then we cal it conflict serializability. See the example picture below to understand conflict serializability.
At first we swap read(A) and read(B) because A and B different data item.
Then we swap  write(B) and write(A) because A and B different data item.
Then we swap write(B) and read(A) because B and A different data item.
And finally we found a serialize schedule. So we say that the first schedule is serializable schedule.
Important: At first consider a concurrent schedule and think it's swapping stage. If you finally found a serial schedule then you cal the first schedule is conflict serializable transaction.

Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP