Bird
0
0

What is the expected result if a transaction running at Serializable isolation level reads data that another concurrent transaction later modifies and commits?

medium📝 query result Q5 of 15
PostgreSQL - Transactions and Concurrency

What is the expected result if a transaction running at Serializable isolation level reads data that another concurrent transaction later modifies and commits?

AThe first transaction sees the original data and may abort if conflicts occur
BThe first transaction immediately sees the new data
CThe first transaction blocks until the other commits
DThe first transaction ignores the other transaction's changes permanently
Step-by-Step Solution
Solution:
  1. Step 1: Understand Snapshot Behavior in Serializable

    Serializable transactions see a consistent snapshot; they do not see changes made after their start.
  2. Step 2: Consider Conflict Detection

    If the other transaction's commit conflicts with the first, the first may abort to maintain serializability.
  3. Final Answer:

    The first transaction sees the original data and may abort if conflicts occur -> Option A
  4. Quick Check:

    Serializable snapshot = Original data, possible abort [OK]
Quick Trick: Serializable reads original snapshot; conflicts cause aborts [OK]
Common Mistakes:
  • Assuming immediate visibility of changes
  • Thinking transactions block on reads
  • Believing changes are ignored forever

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes