isolation SQL Origin: Data OSI layer 7 · Application Last updated 18 Nov 2026

Inconsistent results inside a transaction: non-repeatable and phantom reads (isolation level)

Two reads in the same transaction see different data because another transaction committed in between.

Exact message you may see non-repeatable readphantom readlost update SQLREAD COMMITTED isolation anomalyserialization failure could not serialize access
Seen on: SQL PostgreSQL MySQL SQL Server

Meaning

READ COMMITTED allows non-repeatable and phantom reads; REPEATABLE READ and SERIALIZABLE prevent more anomalies at the cost of locks/retries. Pick the isolation level per need, use SELECT ... FOR UPDATE for read-modify-write, and be ready to retry serialization failures.

Common causes

  • Default READ COMMITTED isolation
  • Read-then-write race (lost update)
  • Phantom rows appearing in range queries
  • No row locking on read-modify-write
  • Long-running reports on changing data

⚡ Quick fix

  1. Use SELECT ... FOR UPDATE where you modify what you read
  2. Raise the isolation level where needed and retry on conflict
  3. Keep transactions short

Detailed fix by platform

SQL

  1. sql
    BEGIN;
    SELECT balance FROM accounts WHERE id = 1 FOR UPDATE;
    UPDATE accounts SET balance = balance - 100 WHERE id = 1;
    COMMIT;

How to diagnose

  1. Isolation — Which level?
  2. Lock — On read?
  3. Retry — Implemented?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1205 — SQL Server Msg 1205: Transaction was deadlocked on lock resources and has been chosen as the deadlock victim (SQL)12051213 — MySQL ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction (MySQL)121325P02 — ERROR: current transaction is aborted, commands ignored until end of transaction block (PostgreSQL)25P02266 — SQL Server Msg 266: Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements (SQL)2663902 — SQL Server Msg 3902: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION (SQL)390240001 — ERROR: could not serialize access due to concurrent update (PostgreSQL)40001429 — Cloud Run: The request was aborted because there was no available instance (HTTP 429) (Google Cloud / Firebase)429A second operation was started on this context — EF Core: A second operation was started on this context instance before a previous operation completed (.NET)A second operation wa…isolation

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.