in Databases
478 views
0 votes
0 votes
T(1) T(2)
R(A)  
  W(A)
W(A)  

SUPPOSE WE HAVE TWO TRANSACTION T1 AND T2.

AND ALSO INTIAL VALUE OF A IS 100. THEN WE FIRST READ  A AND THEN FROM T(2) WRITE A . SO MY DOUBT IS WHEN I AM WRITING A WITHOUT ANY CONDITION SPECIFYING . WHAT DOES IT MEAN ???? WHETHER A IS GOING TO CHANGE TO ANY VALUE AND WE DONT CONDITION OR IT IS JUST WRITING A VALUE WHICH IS 100.

 

I AM NOT GETTING THIS CONCEPT .

in Databases
478 views

4 Comments

@MiNiPanda okk so in above question i put A=10intial 

so explain the value of A at all values of above table 

 

0
0

I assume that W(A) of T1 makes A=15 and W(A) of T2 makes A=20.

T(1) T(2)
R(A) // T1 reads A=10  
  W(A) //T2 directly makes A=20 in the DB [Blind Write]
W(A) //T1 makes A=15 in the DB  

Now A=15 in the DB.

1
1
do several transactions operate on a common local buffer or do they have their own independent local buffers?
0
0

2 Answers

0 votes
0 votes
Best answer

Let me further clarify your confusion. Look at the following picture carefully (along with the color coding),

You can see that I've initialized the value of A in the first line in red color.

Notice that when there is a READ operation, then no change takes place either in the buffer or in the database.

When there is a WRITE operation, then changes take place at both the buffer and the database.

I've added an additional line A=A+5 (in green) so as to show you that here, changes will only take place in the buffer and not in the database.

Also the WRITE operation in the T2 will be a blind write just because it did not read the value of A before writing it in the database.

selected by
1 vote
1 vote
Here,W(A) in T2 means (Blind Write),i.e without reading the actual value of A(100) T2 will write its value and then T1 will write its own value, that means if T2 writes it as A=A-10(90) and then T2 will write it as A=A-20(90-20).

Related questions