G
gk
Here is a Phantom read example I read:
/* Query 1 */
SELECT * FROM users
WHERE age BETWEEN 10 AND 30;
return 2 records.
/* Query 2 */
INSERT INTO users VALUES ( 3, 'Bob', 27 );
COMMIT;
/* Query 1 */
SELECT * FROM users
WHERE age BETWEEN 10 AND 30;
return 3 records.
see It seems to me normal . I don't understand why they are called
'Phantom read' . Look , all transactions are happening in different
time , so we are getting the latest data always. Initially there
were 2 records , Later on , 1 record inserted ..so when we run Query 1
again, we get the updated data i.e 3 records.
So,what is wrong here ? what to be worried here ? why its called
phantom read ?
/* Query 1 */
SELECT * FROM users
WHERE age BETWEEN 10 AND 30;
return 2 records.
/* Query 2 */
INSERT INTO users VALUES ( 3, 'Bob', 27 );
COMMIT;
/* Query 1 */
SELECT * FROM users
WHERE age BETWEEN 10 AND 30;
return 3 records.
see It seems to me normal . I don't understand why they are called
'Phantom read' . Look , all transactions are happening in different
time , so we are getting the latest data always. Initially there
were 2 records , Later on , 1 record inserted ..so when we run Query 1
again, we get the updated data i.e 3 records.
So,what is wrong here ? what to be worried here ? why its called
phantom read ?