Bird
0
0

A developer reports that under Read Committed isolation, their transaction sometimes reads the same row twice but gets different values each time. What is the most likely explanation?

medium📝 Debug Q7 of 15
PostgreSQL - Transactions and Concurrency
A developer reports that under Read Committed isolation, their transaction sometimes reads the same row twice but gets different values each time. What is the most likely explanation?
AThe row is locked and cannot be read twice.
BThe row was updated and committed by another transaction between the two reads.
CThe database is returning uncommitted data.
DThe transaction is using Repeatable Read isolation level.
Step-by-Step Solution
Solution:
  1. Step 1: Recall Read Committed behavior on repeated reads

    Each query sees the latest committed data at query start, so values can change between reads.
  2. Step 2: Evaluate options

    The row was updated and committed by another transaction between the two reads. explains the behavior correctly. The transaction is using Repeatable Read isolation level. contradicts the isolation level. The database is returning uncommitted data. is false for PostgreSQL. The row is locked and cannot be read twice. is incorrect.
  3. Final Answer:

    The row was updated and committed by another transaction between the two reads. -> Option B
  4. Quick Check:

    Read Committed allows non-repeatable reads [OK]
Quick Trick: Read Committed allows data changes between queries [OK]
Common Mistakes:
  • Expecting repeatable reads under Read Committed
  • Thinking uncommitted data is visible
  • Assuming locks prevent re-reading

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes