0

I know that

A non-repeatable read occurs, when during the course of a transaction, a row is 
retrieved twice and the values within the row differ between reads.

and

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.

and I guess that this happens because in both causes we are in transaction A and transaction B just commit some changes.

So my question is... Is there another use case from both or 1 that the cause could be another than transaction B just commit some changes while we are in transaction A ? So basically these are 2 different consequences of the same problem, right ?

La Carbonell
  • 1,976
  • 5
  • 22
  • 52

1 Answers1

3

The discrepancy in a non-repeatable read is always the result of an UPDATE statement, whereas in the case of phantom read, it could also be the result of an INSERT or a DELETE. Also, the first case can be prevented by locking rows, not the second.

Maurice Perry
  • 9,261
  • 2
  • 12
  • 24