What are transaction isolation levels in MySQL?

Why Interviewers Ask This

This is a classic screening question for MySQL / SQL roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

MySQL (InnoDB) supports four isolation levels that control how transactions interact with each other, trading consistency for concurrency: READ UNCOMMITTED: can read uncommitted changes from other transactions (dirty reads — reading data that may be rolled back). Highest concurrency, lowest consistency. Rarely used. READ COMMITTED: can only read committed data. Prevents dirty reads but allows non-repeatable reads (reading the same row twice in the same transaction may yield different results if another transaction committed between the two reads). Used by PostgreSQL and Oracle as default. REPEATABLE READ (MySQL InnoDB default): a transaction sees a consistent snapshot of the data as it was when the transaction started. Prevents dirty and non-repeatable reads. Phantom reads are prevented in InnoDB (but not in the SQL standard definition of this level) via gap locks. SERIALIZABLE: transactions are fully isolated as if executed serially. Prevents all concurrency anomalies but lowest throughput (locks all reads). Set isolation level: SET TRANSACTION ISOLATION LEVEL READ COMMITTED;.

Pro Tip

This topic has MySQL / SQL-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.