Comparison
Read committedvsRepeatable read
Read committed
you only see other transactions' work once they commit, but two reads inside your own transaction can still disagree.
The common default isolation level: each statement sees a snapshot as of when that statement started. It rules out dirty reads and nothing else. Any logic that reads a value, decides something, and writes based on it is unsafe here without explicit locking.
Full entry →Repeatable read
you read the same row twice inside one transaction and are guaranteed to get the same answer both times.
An isolation level where the whole transaction sees one consistent snapshot, so re-reading a row is stable. It removes non-repeatable reads; depending on the engine it may or may not remove phantoms, and it does not remove write skew. In PostgreSQL it is snapshot isolation and can abort your transaction with a serialisation failure you must be prepared to retry.
Full entry →