What are isolation levels in database transactions?

Answer

Transaction isolation levels define how concurrent transactions see each other's uncommitted changes. From weakest to strongest: Read Uncommitted — can read uncommitted changes (dirty reads possible). Read Committed — only reads committed data (default in PostgreSQL, Oracle) — prevents dirty reads but allows non-repeatable reads. Repeatable Read — same query returns the same rows within a transaction (default in MySQL InnoDB) — prevents dirty and non-repeatable reads but allows phantom reads. Serializable — transactions appear to execute serially — prevents all anomalies but has the most locking overhead. Higher isolation = more correctness but lower concurrency.