2,107 views
0 0 votes
A Phantom Read is when two SELECT queries within the same transaction return a different number of rows. But if the number of rows returned is the same and the data is different, is that also considered as Phantom?

2 Answers

0 0 votes

Yes,

A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection of rows returned by the second query is different from the first.

To read more see this link:https://stackoverflow.com/questions/11043712/what-is-difference-between-non-repeatable-read-and-phantom-read

0 0 votes

yes, that would be consider as the Phantom read,

  • let there be Update operation, and you changed some data(on attribute(s) which is in the where clause, obviously), then the result query of the result will be different from before.
  • then the second case would be, let query Q generate result set R = {a, b, c, d} and then you perform first delete, {a, b, c} and then insert, {a, b, c, e}. Now, again the query is same but generating a different result set. Same number of rows and different data, as you asked.

Can be avoided by acquiring range locks.

Also refer, https://en.wikipedia.org/wiki/Isolation_%28database_systems%29#Phantom_reads

• edited by
Position:
Show:

Related questions

–1 –1 vote
1 1 answer
1.2k
1.2k views
iarnav asked Dec 10, 2017
1,180 views
Please explain the concept of DIRTY READ In a simplified manner w/ a small example!
1 1 vote
0 0 answers
853
853 views
S Ram asked Jan 3, 2017
853 views
what is the difference between Unrepeatable read, phantom read and lost update?
0 0 votes
2 2 answers
2.6k
2.6k views
susgir2 asked Jan 4, 2019
2,613 views
Please explain. Use the below transaction.
0 0 votes
0 0 answers
1.6k
1.6k views
sripo asked Nov 25, 2018
1,633 views
If I have dirty read which is write-read conflict does it imply that the schedule is non recoverable?Do all anomalies result of conflict result in non recoverable thereby...