In Repeatable Read Isolation Level, it does not prevent other transactions from inserting new rows into the tables which have been selected in the current transaction. I want to know the theory behind when DELETE or UPDATE query comes? Consider the following example which I'm trying to solve.
Assume use of Relational Database Management System (RDBMS) and rigorous 2-Phase locking approach for concurrency control.
ID Balance Name
1 12 A
2 18 B
10 100 C
The following timing diagram, shows the execution of two concurrent transactions based on the above Customer table, T1 and T2, both of which execute on REPEATABLE_READ transaction isolation level.
T1 T2
SELECT * FROM Customer |
WHERE Balance BETWEEN 10 AND 20; |
| **QUERY X**
| COMMIT; "
SELECT * FROM Customer |
WHERE Balance BETWEEN 10 AND 20; |
Will the Phantom anomaly be exhibited if instead of an INSERT query, one of the following SQL statements is replaced into QUERY X on T2 ? Justify your answer.
- UPDATE Customer SET Balance = 14 WHERE Balance = 100;
- DELETE FROM Customer WHERE Balance = 12;
I'm new to DBMS, So I'm very much appreciated for kind explanations which help me to have a better understanding of these problems.