Q49: What is the difference between a Non-Repeatable Read and a Phantom Read?
- Non-Repeatable Read: Transaction A reads a row. Transaction B updates or deletes that row and commits. Transaction A re-reads the row and finds the values modified or gone.
- Phantom Read: Transaction A executes a range query. Transaction B inserts new rows matching the predicate range and commits. Transaction A re-runs the range query and sees new 'phantom' rows included in the result set.
Key Takeaways
- Non-Repeatable Reads involve existing row updates or deletions.
- Phantom Reads involve new row insertions into active query range conditions.