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

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

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?

Next Step

Continue to What is the difference between optimistic and pessimistic locking?← Back to all SQL questions