SQL & Relational Databases (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What are Phantom Reads vs Non-Repeatable Reads?
senior Levelsql-databasesAdvanced Internals
In Simple Words:
- Non-Repeatable Read: Focuses on modifications/updates to an existing row. Row 1 has salary $50K; after another transaction updates it, Row 1 has salary $60K.
- Phantom Read: Focuses on inserts/deletions affecting a range. Query returns 5 rows matching
WHERE department = 'IT'; after another transaction inserts a new developer, the exact same query returns 6 rows.