Scrivio Interview library
LeadershipPrincipal5 min read · updated 12 November 2026

Engineers across your organisation assume the database default isolation level is safe because it is the default. As head of engineering, how would you set policy for isolation levels across many teams and several database products?

Try it yourself

Isolation levels: what a second read sees

Step through two transactions and see exactly when read committed and repeatable read give different answers.

Read this example as text

T1 at read committed

  1. T1 begins. Transaction T1 starts with isolation level READ COMMITTED. The row holds balance 100.
  2. T1 reads the balance. T1 reads 100. Under read committed each statement looks afresh at what is committed when the statement starts.
  3. T2 changes the row. A second transaction, T2, sets the balance to 150 but has not committed. The database keeps both versions: 100 is still the committed one.
  4. T1 reads again, before T2 commits. T1 reads 100 again. Neither level shows another transaction's uncommitted change, so there is no dirty read. T1 does not wait for T2 either.
  5. T2 commits. T2 commits. The committed balance is now 150.
  6. T1 reads a third time. T1 reads 150. The same query, inside one transaction, returned 100 and then 150. This is a non-repeatable read, and read committed allows it.
  7. T1 commits. T1 ends. A transaction that starts now reads 150 at either level.

T1 read 100, 100, then 150: a non-repeatable read.

T1 at repeatable read

  1. T1 begins. Transaction T1 starts with isolation level REPEATABLE READ. The row holds balance 100.
  2. T1 reads the balance. T1 reads 100. Under repeatable read this first read fixes T1's snapshot: T1 will keep seeing the data as it was committed at this moment.
  3. T2 changes the row. A second transaction, T2, sets the balance to 150 but has not committed. The database keeps both versions: 100 is still the committed one.
  4. T1 reads again, before T2 commits. T1 reads 100 again. Neither level shows another transaction's uncommitted change, so there is no dirty read. T1 does not wait for T2 either.
  5. T2 commits. T2 commits. The committed balance is now 150.
  6. T1 reads a third time. T1 still reads 100. Its snapshot was fixed at its first read, so T2's commit is invisible to it. The read is repeatable.
  7. T1 commits. T1 ends. A transaction that starts now reads 150 at either level.

T1 read 100 three times: its reads were repeatable.

What this example leaves out
  • Modelled on PostgreSQL and MySQL InnoDB, where a plain SELECT reads a snapshot and never waits for a writer.
  • SQL Server's default read committed uses locks instead: there, T1's second read would wait for T2 to finish.
  • Only reads are compared. What happens when T1 also writes the row (a lost update, or an error in PostgreSQL) is not modelled.

The policy has to start by saying plainly that a default isolation level was chosen by the vendor for throughput and backward compatibility, not for the correctness of our rules. I would require every service to state its isolation level and the invariants it protects, with the actual semantics of its database product, give teams paved paths that make the safe choice easy, make compliance auditable with static checks, dashboards and reconciliation jobs, and review the policy whenever databases, versions or defaults change.

Why this question is asked

The belief that the default must be safe is natural: defaults in most software are chosen to be reasonable. For isolation levels, that belief causes real damage, because the default in most databases allows lost updates and write skew, and the bugs show up only under production load. A head of engineering cannot fix this by reviewing code; there are too many teams and too many databases. Interviewers ask this to see how a leader turns a technical truth into a policy people follow. In this answer, we will look at why defaults are what they are, what the policy requires, the paved paths that make it cheap, how to audit it, and how to keep it current.

1Why the Default Is Not a Safety Guarantee

An isolation level is a database's promise about how concurrent transactions affect each other. PostgreSQL, Oracle and SQL Server default to READ COMMITTED; MySQL InnoDB defaults to REPEATABLE READ. Vendors set these defaults decades ago for throughput, because weaker levels mean less waiting and fewer aborted transactions, and they keep them for backward compatibility, because changing a default would break millions of existing applications. None of that has anything to do with our invariants, the rules our data must obey, such as stock never oversold or one primary address per customer.

The policy should say this in one sentence that everybody can repeat: the default isolation level is a performance choice made by the vendor, not a correctness guarantee for your service. Under READ COMMITTED, a read-then-write in a @Transactional method can lose an update, and a check across rows can be bypassed by a concurrent transaction. That is normal, documented behaviour.

2What the Policy Requires of Every Service

Every service states, in its design document, the isolation level it runs at and the invariants it protects, and for each invariant the mechanism that protects it: a constraint, a conditional update, a lock, or a stronger isolation level. The statement must use the real semantics of the product, because names mislead: REPEATABLE READ on PostgreSQL is snapshot isolation and raises serialization errors, while on InnoDB it lets locking reads and updates see the latest data; SERIALIZABLE on Oracle is snapshot isolation, not true serializability. A one-page reference per database product, maintained by the platform team, gives the facts teams need to fill this in.

Design document section on isolation
FieldExample
Database and versionPostgreSQL 17
Isolation levelREAD COMMITTED; booking path SERIALIZABLE
Invarianta seat is booked at most once per show
Protectionunique (show_id, seat) plus SERIALIZABLE with retry
Concurrency testBookingRaceIT, two transactions with a latch
Reconciliationnightly duplicate seat query, alert if non-empty

3Paved Paths That Make It Easy

A policy that only adds paperwork will be followed on paper. So the platform provides paved paths per database product: a shared transaction utility that sets the level, retries serialization failures and deadlocks with bounded attempts and records metrics; constraint patterns, such as partial unique indexes and exclusion constraints on PostgreSQL, with examples; and concurrency test templates using Testcontainers, where two transactions are forced to interleave with a latch. A team that follows the paved path fills in the design section in minutes, because the answers are mostly 'we used the standard library and the standard test'.

4Making the Policy Auditable

Leadership needs to know whether the policy works without reading every pull request. Three mechanisms make it auditable. Static checks in the build flag likely read-then-write patterns, such as a repository find followed by a save of the same entity in one transactional method without a version or lock, and transactional code with no stated isolation in its service's design document. Dashboards show serialization failures, deadlocks and retry rates per service, so we see where contention lives and whether retries are in place. Reconciliation jobs run queries for each critical invariant, such as duplicate primary addresses, and alert when they find violations; their findings are the most honest measure of whether the policy is protecting data.

Step throughHow the policy runs
  1. Design document states level and invariantsusing the product's real semantics
  2. Team uses the paved pathtransaction utility, constraints, test template
  3. Build runs static checksread-then-write without protection
  4. Production dashboards and reconciliation jobsfailures, retries, violations
  5. Findings or incidents?
    YesHelp the team fix, update the paved pathNoReview at the next policy cycle

5 steps in order. Play them, or step through them one at a time.

5Keeping the Policy Current

Isolation behaviour changes when the platform changes: a new major version, a move to a managed service, a different default such as READ_COMMITTED_SNAPSHOT being on in Azure SQL Database, or a migration from MySQL to PostgreSQL, where the default level, gap locks and error handling all change at once. So isolation is part of every migration checklist and every vendor selection checklist, and the policy is reviewed on a fixed schedule and whenever a database version or product changes. Incident reviews that find an anomaly as root cause feed back into the paved paths, so each bug makes the next one less likely.

6Follow-up questions

What would you put in the design document template?

The database product and version; the isolation level for the service and any paths that differ; each invariant in plain words; for each invariant the protection mechanism and why it is sufficient on this product; how serialization failures and deadlocks are retried; the name of the concurrency test that proves the invariant under interleaving; and the reconciliation query that detects a violation in production. It should fit on one page, and a reviewer should be able to check it in five minutes.

Would you mandate SERIALIZABLE everywhere instead?

Not as the first step across several products, because SERIALIZABLE means different things on each and costs retries. I would require an explicit, justified choice, and offer SERIALIZABLE as a paved path where the product implements it well, such as PostgreSQL.

How do you get teams to take it seriously?

By using our own incidents as the teaching material, by making the paved path faster than the alternative, and by reviewing reconciliation findings in the same forum as availability incidents.

7Conclusion

In this answer, we saw that a default isolation level is a vendor's throughput and compatibility choice, not a guarantee for our invariants, and that the policy must say so plainly. Every service states its level and invariants with the product's real semantics; paved paths of shared transaction utilities, retries, constraint patterns and concurrency tests make that cheap; static checks, dashboards of serialization failures and deadlocks, and reconciliation jobs make it auditable; and the policy is reviewed whenever databases, versions or defaults change.

What to say in the interviewAbout 80 seconds aloud

Open with

I'd start by saying it plainly in the policy: the default isolation level was chosen by the vendor for throughput and backward compatibility, not for the correctness of our invariants.

Then, if they want more

READ COMMITTED, which is the default in PostgreSQL, Oracle and SQL Server, allows lost updates and write skew, and that's documented behaviour, not a bug.

Then I'd require every service to state, in its design document, its isolation level, the invariants it protects, and how each one is protected, using the real semantics of its database product, because REPEATABLE READ on PostgreSQL and on MySQL are different things.

To make that cheap, the platform would provide paved paths for each product: a shared transaction utility with retries for serialization failures and deadlocks, constraint patterns like partial unique indexes, and concurrency test templates that force two transactions to interleave.

To make it auditable, I'd add static checks for read-then-write patterns without protection, dashboards of serialization failures and deadlocks per service, and reconciliation jobs that alert when an invariant is violated in production.

And I'd review the policy whenever databases change version or defaults, and put isolation on every migration and vendor selection checklist, so a move from MySQL to PostgreSQL, for example, gets reviewed for exactly these changes.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Engineers across your organisation assume the database default isolation level is safe...": https://scrivio-interview-library.netlify.app/databases/acid-and-isolation/8fac363a9a/