1,430 views
0 votes
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 votes
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 votes
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

Related questions

–1 votes
–1 votes
1 answer
1
iarnav asked Dec 10, 2017
742 views
Please explain the concept of DIRTY READ In a simplified manner w/ a small example!
0 votes
0 votes
2 answers
2
0 votes
0 votes
0 answers
3
sripo asked Nov 25, 2018
1,220 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...