Repeatable Read
Repeatable read prevents dirty reads and non-repeatable reads: multiple reads of the same row within a transaction return identical results, but phantom reads are still allowed.
Purpose
To provide stronger consistency than read committed, ensuring stable reads within a transaction.
Mechanism
On first read the transaction locks the row or fixes a snapshot version; subsequent reads of the same row return the same value. But range queries may return more rows if other transactions insert (phantom reads). MySQL InnoDB prevents phantoms via next-key locks.
Use cases
- Consistent reads within transactions
- Isolation level selection
- Phantom read analysis