Bird
0
0

Why do phantom reads occur even when a transaction reads the same query twice under REPEATABLE READ isolation?

hard📝 Conceptual Q10 of 15
SQL - Transactions and Data Integrity
Why do phantom reads occur even when a transaction reads the same query twice under REPEATABLE READ isolation?
ABecause REPEATABLE READ causes lost updates
BBecause REPEATABLE READ allows dirty reads
CBecause REPEATABLE READ does not prevent non-repeatable reads
DBecause REPEATABLE READ does not lock range scans, allowing new rows to appear
Step-by-Step Solution
Solution:
  1. Step 1: Understand REPEATABLE READ locking

    REPEATABLE READ locks rows read but does not lock the range of rows scanned, so new rows can be inserted and appear on repeated queries.
  2. Step 2: Identify cause of phantom reads

    Phantom reads happen because new rows appear in the range, which REPEATABLE READ does not prevent.
  3. Final Answer:

    Because REPEATABLE READ does not lock range scans, allowing new rows to appear -> Option D
  4. Quick Check:

    Phantom reads allowed by range scan gaps [OK]
Quick Trick: REPEATABLE READ misses range locks, causing phantom reads [OK]
Common Mistakes:
  • Thinking REPEATABLE READ allows dirty reads
  • Confusing phantom reads with non-repeatable reads
  • Assuming lost updates cause phantom reads

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes