Skip to content

Transaction concepts

Two halves. The theory doesn't change when you switch databases: what a transaction promises, what the isolation levels trade away, and the full vocabulary of things that go wrong. What each engine actually does about that vocabulary changes a great deal, and the comparison below puts PostgreSQL's and MySQL's answers in adjacent cells. Every claim on either side links to a transcript from a real run that proves it.

Theory

  • What is a transaction? (ACID) — the unit of work, and what each of the four letters actually promises.
  • Isolation levels — the SQL standard's four-level ladder, what each level permits, and where the standard stops telling the whole story.

The anomalies

The anomaly catalog names every isolation anomaly, from the SQL standard's classic three to Adya's full formal list. The five that matter most in practice get their own pages:

The comparison

  • Anomalies by engine — one row per anomaly, one column per engine, each cell naming the weakest isolation level at which that engine prevents it. The lost-update row is two levels apart.

Patterns

Then pick an engine

Theory is where the databases agree. The lessons are in where they don't:

  • The PostgreSQL track — snapshots everywhere, conflicts surface as retryable errors (40001), dirty reads impossible at every level.
  • The MySQL track — InnoDB's locks and current reads, real dirty reads at READ UNCOMMITTED, conflicts surface as deadlocks (1213).

MIT Licensed · Every transcript on this site was generated by a real database run against MySQL 8.4.10 and PostgreSQL 18.4 at bd6f201, and re-proven through psycopg and PyMySQL.