in Databases
1,268 views
1 vote
1 vote

HOW TO SOLVE THOSE TYPE OF QUESTION?

in Databases
1.3k views

17 Comments

I AM GETTING 29 OR 30 ......

WHAT IS THE ANS
0
0

Deepanshu How are you getting it?

I got 12 only but not sure :(

0
0
edited by

@MiNiPanda

Here blind write perform by w1(B) and w2(B) , blind write means write before read. 

now, w3(B) is fixed due to the rule "last operation on some item should be same in view equivalence schedule."

so leaving w3(B) we have 5 schedule, we can arrange them in 5! = 120 way .

r1(A) w1(A)can be arranging 2! way 

r2(A) w2(A) can be arranging 2! way

so total number of view equal schedule possible (120 / 2! 2! ) = 30

in all these 30 schedules  w3(B) is last transaction , it is fixed.

0
0
And what about initial read? Since no one is changing A so any transaction can do R(A) and that does not matter..is it the reason for which we don't need to consider initial read?
0
0

@MiNiPanda YEPP FROM MY VIEW 

1
1

@MiNiPanda MY DOUBT IS ARE WE CONSIDERING ABOVE ONE ALSO THEN 30.

IF WE EXCLUDE ABOVE ONE 29 .

SO SHOULD BE WRITE ALL OR NOT UP ABOVE

0
0

ARE WE CONSIDERING ABOVE ONE

Which above one i didn't get you..

0
0

@MiNiPanda the one which is given in question is also view serializable na......

0
0
Oh okay..yes good point :p should be 29..
0
0
@Deepanshu the ans is 30.BUT PLEASE TELL HOW R3(A) AND R2(A) IS ARRANGED IN 2! WAYS?

HOW U GOT  30?PLEASE EXPLAIN ELABORATELY.
0
0
do we don't need to fix initial read....R(A) is first performed by T1....in view equivalent we have to look for 1st read and last write??
0
0

@Avik Chowdhury SORRY IT IS R1 AND R2

0
0
@minipanda why we are dividing 5! By 2! 2!

Why we are doing it ? Please explain it a bit more
0
0

Prince Sindhiya

r1(A) w1(B) r2(A) w2(B) r3(A) w3(B)

We are fixing the last write operation w3(B) and there are remaining 5.

Now we can arrange these 5 in 5! ways but should not forget that these 5! arrangements will contain those arrangements in which w1(B) will come before r1(A) and w2(B) will come before r2(A). So whatever be the arrangements (r1(A) has to come before w1(B)) and (r2(A) has to come before w2(B)). 5! contains these 2! [arranging b/w r1(A) and w1(B)]  and 2! [arranging b/w r1(A) and w1(B)] ways included in it. So these extra have to be divided.

That's why 5! is divided by 2!*2!.

0
0
Ok bro i got it and that's why I drawn that polygraph see it :)
0
0
Hey, can someone explain to me why we aren't taking the initial read condition here? like T1 is doing the initial read of A from the database so, in every view serializable schedule, T1 should do that only I think ?
0
0
0
0

3 Answers

2 votes
2 votes
Best answer

A schedule Si that is view equivalent to another schedule Sj must the following conditions satisfied:

1. If transaction Ti reads the initial value of a data item in a schedule Si, then transaction Ti should read the initial value of that data item in schedule Sj.

Here since all the three transactions are reading the initial values of data item A, so in the view equivalent schedule also, all the three transactions will read the value of data item A.

2. if a transaction Ti writes the value of a data item(producer) that is read by a transaction Tj (consumer) in a schedule Si, then transaction Ti must write the value of the data item that is read by Tj in the schedule Sj.

In this question, since there are no producer-consumer dependencies between the transactions in the schedule S, so we need not worry about this condition not being satisfied in the view equivalent schedule.

3.if a transaction Ti writes the final value of a data item in schedule Si, then transaction Ti must also write the final value of that data item in schedule Sj.

Since here transaction T3 writes the final value of data item B in the schedule S, so in all schedules that are view equivalent to S, transaction T3 must write the final value of data item B.

Hence keep W3(B) fixed at the end. the remaining 5 operations can be arranged in 5! ways and the since the ordering of operations within a single transaction must not change, so divide 5! by 2! for each of the two transactions T1 and T2(Note: since there is only a single operation remaining in T3 after fixing W3(B) at the end, so we need not worry about the ordering of R3(B) since there is only one place left for it to appear, i.e. before W3(B))

Therefore, the number of schedules that are view equivalent to S are= 5! / (2! * 2!)=30

hence 30 view equivalent schedules are possible out of which one is already given in the question, i.e. schedule S.

selected by
0 votes
0 votes
Only one schedule is possible which is  (T1 T2 T3)

Is the answer is correct ??

inform me  kindly
by

2 Comments

@Magma read question carefully it is already serial

0
0

Deepanshu  please explain me how to solve these type of questions ?

I didn't understood properly

0
0
0 votes
0 votes

The polygraph for it would be this right ?

4 Comments

But see the previous comments..The initial Read on A does not matter as no one is modifying A so it's not compulsory for T1 to read A before anyone else. So whatever be the Read order of A, all of them will be reading the same unmodified value.
0
0
okay so what if t2 or t2 were modifying the value of A ?
0
0
Then the order of initial read would have mattered
1
1

Related questions