Questions: Phantom Read Anomaly: New Rows Appearing

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Transaction A runs SELECT * FROM orders WHERE status = 'pending' and gets 50 rows. Transaction B then inserts a new pending order and commits. Transaction A runs the same query again and gets 51 rows. Which isolation level, at minimum, prevents this anomaly?

ARead committed — it only reads committed data
BRepeatable read — it locks all rows read by the transaction
CSerializable — it locks the predicate, preventing new matching rows from being inserted
DRead uncommitted — it blocks all concurrent writes
Question 2 Multiple Choice

A banking system sums all transactions for an account within a transaction, then uses that sum to decide whether to approve a transfer. A phantom read occurs mid-transaction. What is the WORST CASE outcome?

AThe sum query fails with an error, forcing a retry
BThe transfer decision is made on a stale sum that doesn't reflect a concurrent deposit, potentially approving an incorrect amount
CThe transaction is automatically rolled back by the database
DThe sum is recalculated automatically to include the new row
Question 3 True / False

Repeatable read isolation prevents phantom reads because it locks most rows that match a query's WHERE clause.

TTrue
FFalse
Question 4 True / False

Preventing phantom reads requires locking not just existing data rows, but the predicate — the condition that defines which rows qualify — so that new qualifying rows cannot be inserted.

TTrue
FFalse
Question 5 Short Answer

Why can't row-level locking, even if perfectly implemented, prevent phantom reads? What additional mechanism is required?

Think about your answer, then reveal below.