Consider a relation R(product, value). There are initially two tuples in R: (A,1
ID: 3736445 • Letter: C
Question
Consider a relation R(product, value). There are initially two tuples in R: (A,10) and (B,20). The following two transactions are executed concurrently: T1 BEGIN TRANSACTION S1: Update R set value = value +5 S2: Insert into R values (C, 30) COMMIT;
T2 BEGIN TRANSACTION S3: Select sum(value) as s from R S4: Select max(value) as m from R COMMIT;
T1 always executes with isolation level Serializable. Assume both transactions successfully commit, and the individual statements S1, S2, S3, and S4 within the transactions each execute atomically.
a) If transaction T2 also executes with isolation level Serializable, which possible pair of values for the sum (s) and max (m) can be returned by T2? Explain
b) If transaction T2 executes with isolation level Read Committed, which possible pair of values for the sum (s) and max (m) can be returned by T2? Explain
c) If transaction T2 executes with isolation level Read Uncommitted, which possible pair of values for the sum (s) and max (m) can be returned by T2? Explain
Explanation / Answer
Solution:
a)
In this case, S3 will return 15+25+30= 70
and
S4 will return 30
Explanation:
In Isolation level serializable the transaction reads data which is committed by the transaction
b)
In this case
S3 will return 10+20= 30
and
S4 will return 20
Explanation:
READ COMMITTED. Specifies that statements cannot read data that has been modified but not committed by other transactions.
c)
S3 will return 15+25= 40
S4 will return 30= 70
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)