SQL Server Interview Question #158

What are REPEATABLE READ and SERIALIZABLE?

Transactions, Locking, Blocking & Deadlocks Senior Advanced

Detailed Explanation

REPEATABLE READ prevents other transactions from modifying rows that the current transaction has read until the transaction completes, preventing non-repeatable reads. However, new rows that match the search condition can still appear in a repeated query.

SERIALIZABLE is more restrictive. It also protects key ranges so other transactions cannot insert qualifying rows that would create phantoms for the protected range.

These isolation levels can increase blocking and should be used only when the stronger consistency guarantees are required.