intermediateIsolation Levels — Dirty Read, Phantom Read, Non-Repeatable Read
A financial report queries the same accounts table 10 times across a complex calculation. The report shows inconsistent totals because data changed mid-calculation. What isolation level solves this?
Use REPEATABLE READ isolation for the report transaction: BEGIN; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; -- All 10 queries here see the SAME consistent snapshot -- even if other transactions commit changes during the report COMMIT. With REPEATABLE READ: all queries in the transaction see the data as it was at the moment BEGIN was executed. No data changes by concurrent transactions are vi
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response