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? Databases databases transaction-and-concurrency + – Sumaiya23 2.1k views answer comment Share Follow Print See 1 comment 1 1 comment reply Ashwin Kulkarni commented Dec 15, 2017 reply Follow flag When number of rows are same but data is different then someone performed UPDATE on it. Hence these problems will be considered as Nonrepeatable read Phantom read occurs only when rows are increased or decreased. 3 3 replyShare Please log in or register to add a comment.
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 Rajnish Kumar 1 answered Dec 15, 2017 Rajnish Kumar 1 comment Share Follow See all 2 Comments 2 2 Comments reply Ashwin Kulkarni commented Dec 15, 2017 reply Follow flag @Rajnish According to your link also this case is considered as non repeatable read. Hence this problem can't be considered as phantom. 0 0 replyShare Rajnish Kumar 1 commented Dec 15, 2017 reply Follow flag Phantom-read occurs when we execute some query on no. of rows and Non-repeatable read is considered only on a particular row in the table. Example of Phantom Read Query are: AVG SUM(), COUNT() etc. It depends upon on query which you execute. 0 0 replyShare Please log in or register to add a comment.
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 Shobhit Asati (tafr! answered Dec 16, 2017 • edited Dec 16, 2017 by Shobhit Asati (tafr! Shobhit Asati (tafr! comment Share Follow 0 reply Please log in or register to add a comment.