简体   繁体   中英

What's the Difference between Conflict Serializable and Serializable?

My understanding is that conflict serializable implies serializable. I'm not sure how that makes them different. Does serializable mean conflict serializable?

Conflict serializable is a subset of serializable, so just because a schedule is conflict serializable does mean it is serializable.

See cow book Database Management System 2rd Ed Cha19.1.1 P541

Every conflict serializable schedule is serializable.

A serializable but not conflict serializable schedule is

T1 : R(A)       W(A) C
T2 :     W(A) C
T3 :                   W(A) C

This is not conflict serializable (by precedence graph) but is equivalent to serializable schedule

T1 T2 T3

because T3 blind writes the output in both schedule.

Conflict serializability is a subset of serializability . If a schedule is conflict serializable, it is implied that this schedules is serializable.

It is computationally easier to determine if something is conflict serializable as opposed to just serializable. Simply construct a precedence graph . If the graph is non-cyclic, then this schuedule is conflict-equivalent to some serial schedule described by the pathing of the graph.

Imagine transactions AB and C, all writing to the same page. A writes, then B, then C, then A again. There is no serializable schedule that is conflict-equivalent. A must go first, because B and C have a conflict after A. But A must also go last, since B and C have a conflict before A. Hence the cycle in the graph.

But just because it is not conflict serializable does not mean it is not serializable. For example, if the last write of A was exactly the same as C's write, then ABC would be a serial schedule equivalent to the original, because the last write didn't end up mattering.

Conflict serializable is a subset of view serializable. "A schedule can be conflict serializable but not view serializable(as in case of blind writes)

In simple Words, Suppose there is a schedule(S) with two transaction T1,T2. Let Result1, Result2 be two variables, where Result1 is produced after running T1 and then T2, ie T1->T2;(serially) Result2 is produced after running T2 and then T1, ie T2->T1;(serially)

Now suppose we interleave the actions of the two transaction, let us call it schedule S, now if the net result produced after running S is equivalent to Result1 or Result2 then we call it serializable.

But, if we can swap the non-conflicting actions and produce a serial schedule that is equal to a schedule in which T1 is run first and then T2(T1->T2), or T2 is run first and then T1(T2->T1) then we call it conflict-serializable.

Now if a schedule is conflict-serializable then it is bound to be serializable as it can be changed to some serial order by swapping the non-conflicting actions.

Hence we can conclude, every conflict-serializable schedule is serializable but not all serializable schedule are conflict-serializable.

Straight Definition with the understanding of conflicting actions:

A schedule is conflict serializable if it is conflict equivalent to some serial schedule. Every conflict serializable schedule is serializable.

在此处输入图片说明

The above example is serializable but not conflict serializable. There is no such serial that has the same conflicting actions. Serializable because it still achieves concurrency to serial T1->T2->T3, but does not share conflicting actions. The writes of T1 and T2 are in different order in the example opposed to the serial.

Serializability has two types: Conflict and View. Conflict serializable determines if a schedule is equivalent to some serial schedule keeping the conflicting operations(RW or WR or WW) in the same sequence as in the original schedule.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM