Quick revision
The short answer
I would support the proposal with conditions. SERIALIZABLE in PostgreSQL makes any set of individually correct transactions correct together, so write skew and lost update bugs disappear, but it turns them into serialization failures that every transactional entry point must retry, costs some throughput and predicate lock memory, and only holds when all transactions on the data use it. I would roll it out through a shared library with retries and metrics, load tests, new services first, and documented exceptions for high-contention paths.
What to remember
In this answer, we evaluated SERIALIZABLE as a default for new PostgreSQL services. It removes write skew and lost update bugs by guaranteeing that individually correct transactions stay correct together, but it costs retries on 40001, some throughput and predicate lock memory, and it needs short side-effect-free transactions with every transaction on the data at the same level. A shared retry library with metrics, a role-level default, load tests, new services first and documented exceptions make the rollout safe.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would support the proposal with conditions. SERIALIZABLE in PostgreSQL makes any set of individually correct transactions correct together, so write skew and lost update bugs disappear, but it turns them into serialization failures that every transactional entry point must retry, costs some throughput and predicate lock memory, and only holds when all transactions on the data use it. I would roll it out through a shared library with retries and metrics, load tests, new services first, and documented exceptions for high-contention paths.
Why this question is asked
Making developers stop reasoning about anomalies is an attractive goal, because most of them do not reason about anomalies correctly anyway. But a default changes the failure mode of every service, from rare silent data errors to frequent visible retries, and that has costs that must be designed for. Interviewers ask this to see whether we can evaluate a platform decision rather than just pick a side. In this answer, we will recap what SERIALIZABLE gives in PostgreSQL, weigh benefits and costs, list the preconditions, and lay out a rollout with monitoring and a clear threshold for reconsidering.
1A Quick Recap of SERIALIZABLE in PostgreSQL
PostgreSQL's SERIALIZABLE uses Serializable Snapshot Isolation, SSI. Transactions read from snapshots as at REPEATABLE READ, so readers do not block writers. In addition, PostgreSQL tracks what each transaction read with non-blocking predicate locks, and when two concurrent transactions could produce a result no serial order would give, it aborts one with SQLSTATE 40001. The guarantee is simple to state: if each transaction is correct when run alone, the system is correct when they run together.
2What the Platform Gains
The benefit is that a whole class of bugs disappears without anyone having to see it coming. The doctor on-call write skew, the double-booked room checked in Java, the stock reservation that reads and then writes: each becomes an aborted transaction that is retried and then refused correctly. Code reviews no longer depend on the reviewer imagining two requests interleaving, and newer engineers write correct code by default. Since these bugs typically surface months later as corrupted data and cost far more to investigate than to prevent, the value is real.
3What It Costs
The first cost is failures. Under contention, some transactions abort and must run again, so every transactional entry point needs a retry wrapper, and code that was never written to be retried, for example because it sends an email inside the transaction, becomes a bug. The second is performance: tracking reads costs CPU and shared memory for predicate locks, conflicts cost wasted work, and throughput on contended workloads drops, sometimes by a little and sometimes a lot. The third is subtle: the guarantee only holds if every transaction touching the data runs at SERIALIZABLE. A batch job or an admin tool running at READ COMMITTED on the same tables is not tracked, and can still create anomalies.
| Aspect | With SERIALIZABLE as default |
|---|---|
| Write skew, lost updates | prevented for all participating code |
| Developer burden | lower: no anomaly reasoning per feature |
| Failure mode | 40001 aborts that must be retried |
| Throughput | some loss; larger on hot, contended data |
| Memory | predicate locks in shared memory |
| Guarantee scope | only if every transaction on the data uses it |
4Preconditions Before It Becomes the Default
Four things must be true, or the default creates new problems. Transactions must be short, because a long transaction holds read tracking longer and is more expensive to retry. Transactions must contain no side effects, such as HTTP calls, emails or messages, so that a retry cannot duplicate them; those move to an outbox. Retries must be safe, which means the whole unit of work is idempotent when re-run from the start. And every transaction on the shared data must run at SERIALIZABLE, which for a new service is easy to enforce by setting default_transaction_isolation = 'serializable' on the database or the service's role, so even code that forgets the annotation is covered.
5How I Would Roll It Out
The rollout makes the safe path the easy path. A shared transaction library wraps each entry point with a retry policy for 40001 and 40P01, three attempts with jittered backoff, and emits metrics for every retry and every final failure. A database role setting makes SERIALIZABLE the default for new services. Before each service goes live, a load test on representative traffic measures abort rate and latency. New services start first; existing ones move only when their owners have retries in place. High-contention paths, such as a single hot counter, can get a documented exception with an alternative protection, like a conditional update or a lock row, recorded in the design document.
- Ship shared libraryretry on 40001 and 40P01, metrics, outbox helper
- Set default_transaction_isolation per rolenew services only
- Load test each serviceabort rate, p99 latency
- Abort rate acceptable?YesGo live, keep dashboardsNoFix indexes or hot spots, or document an exception
- Migrate existing servicesone at a time, owner opt-in
5 steps in order. Play them, or step through them one at a time.
6Monitoring and Tuning After Launch
We watch three numbers per service: the rate of 40001 retries, the rate of final failures after all attempts, and p99 latency. pg_locks with mode SIReadLock shows predicate lock counts; many page or relation locks mean the tracking has been coarsened, which raises false-positive aborts. The usual fixes are indexes for queries that currently scan whole tables, shorter transactions, higher max_pred_locks_per_transaction, and declaring read-only transactions READ ONLY so PostgreSQL can track them less.
7Follow-up questions
What abort rate would make you reconsider?
A few retries per thousand transactions is normal and cheap. I would investigate when a service's retry rate stays above about 1 to 2 percent of transactions at normal load, and I would reconsider the default for that path if final failures, transactions that fail all three attempts, become visible to users, or if p99 latency rises by more than the service's budget. At that point the problem is usually a hot spot, and the answer is to redesign that path, not to drop the default everywhere.
Why not let each team choose?
Teams would choose READ COMMITTED by habit, and the bugs we want to remove come from exactly the cases where nobody noticed the risk. A strong default with explicit exceptions keeps the choice visible.
Does SERIALIZABLE replace constraints?
No. Constraints are still cheaper, clearer and enforced for every writer, including those not at SERIALIZABLE. SERIALIZABLE covers the rules constraints cannot express.
8Conclusion
In this answer, we evaluated SERIALIZABLE as a default for new PostgreSQL services. It removes write skew and lost update bugs by guaranteeing that individually correct transactions stay correct together, but it costs retries on 40001, some throughput and predicate lock memory, and it needs short side-effect-free transactions with every transaction on the data at the same level. A shared retry library with metrics, a role-level default, load tests, new services first and documented exceptions make the rollout safe.
Open with
I'd support it, with conditions. The benefit is real: under PostgreSQL's SERIALIZABLE, any set of transactions that are each correct alone is correct together, so write skew and lost updates stop being something every developer must spot in review.
Then, if they want more
The cost is that those bugs turn into serialization failures, SQLSTATE 40001, so every transactional entry point needs a retry wrapper, and there's some throughput loss and predicate lock memory.
There are also preconditions: transactions must be short, have no side effects inside like emails or HTTP calls, be safe to re-run, and every transaction on that data must run at SERIALIZABLE, because a READ COMMITTED batch job isn't tracked.
For the rollout I'd ship a shared library that retries 40001 and 40P01 with jittered backoff and reports metrics, set default_transaction_isolation on new services' roles, load test each service with representative traffic, start with new services only, and allow documented exceptions for high-contention paths where a conditional update or a lock row works better.
After launch I'd monitor the retry rate, final failures and p99 latency, plus predicate lock counts in pg_locks, and add indexes where scans coarsen the locks. I'd look closely at any service retrying more than one or two percent of transactions.
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.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
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 "An architecture group proposes making SERIALIZABLE the default isolation for all new...": https://scrivio-interview-library.netlify.app/databases/acid-and-isolation/9377ab4a36/