Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider table Product(Item,Price) where Item is a key, and the following two co

ID: 3842831 • Letter: C

Question

Consider table Product(Item,Price) where Item is a key, and the following two concurrent transactions.

T1:

  Begin Transaction

  update Product set Price = 2*Price where Item = ‘Laptop’;

  insert into Product values (‘Printer’,$100);

  Commit;

T2:

  Begin Transaction

select max(Price) as a1 from Product;

select max(Price) as a2 from Product;

  Commit;

Assume that the individual statements in a given transaction always execute atomically. Suppose initially there are two tuples in Item: (Laptop, 1000), (PC,900). Each transaction runs once and commits. Transaction T1 always executes with isolation level Serializable.

(a) If transaction T2 executes with isolation level Read-Uncommitted, what possible pairs of values a1 and a2 are returned by T2.

(b If transaction T2 executes with isolation level Read-Committed, what possible pairs of values a1 and a2 are returned by T2.

(c) If transaction T2 executes with isolation level Repeatable-Read, what possible pairs of values a1 and a2 are returned by T2.

(d) If transaction T2 executes with isolation level Serializable, what possible pairs of values a1 and a2 are returned by T2.

Explanation / Answer

As given Transaction T1 was always executes with isolation level serializable. So T1 does at once with commit.

a)
If T2 is read uncommited, then it allows dirty reads that can read before t1 commits which gives result as
1000, 1000, 1000, 2000, 2000, 2000

b)
If T2 is read committed, reads are allowed only after transactions are completed. So on basing t1 commit will get the result as [1000,1000] or [2000,2000]

c)
If T2 is repeatable read, then update in T1 is not allowed to alter/update till we rollback t2. So we get [1000,1000] or [2000,2000]

d)
As T2 is also serializable, it allows to read committed data only by T1, so we will get 2000,2000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote