Let's say I have the following transactions T1
and T2
.
--T1
UPDATE Employee SET Salary=Salary*10;
UPDATE Employee SET Bonus=Bonus+5;
--T2
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT AVG(Salary) FROM Employee;
SELECT MAX(Bonus) FROM Employee;
From my understanding repeatable read in T2 will put a lock on Salary and only release it when the transaction completes. Does that mean that if T2 starts first T1 will just wait until T2 finishes? Because T1 won't be able to update Salary until T2 releases that lock (i.e when it finishes).