SteelReed

Search

Search posts, questions…

Transactions & LockingQuestion 2 / 17

Junior

Which anomalies does each isolation level prevent: dirty, non-repeatable and phantom reads?

Short answer

The isolation level decides how much of other transactions' changes you see: higher means fewer bad reads but slower. Defaults: PostgreSQL READ COMMITTED, MySQL REPEATABLE READ.

blocks dirty readsblocks non-repeatableblocks every anomalyREAD UNCOMMITTEDdirty reads happenREAD COMMITTEDPostgreSQL defaultREPEATABLE READInnoDB defaultSERIALIZABLE

3 points to say:

  1. Dirty: reading uncommitted data.
  2. Non-repeatable: the same row reads differently.
  3. Phantom: the same filter returns a different set of rows.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.