Part 3 of 5 · 1 min read
Why always use serializable is usually the wrong default
Serializable isolation prevents every anomaly, but at a real concurrency and abort-and-retry cost that most logic does not need to pay.
Think of locking every single door in a building, all day, simply because one specific room occasionally holds something valuable. A lock on that one room alone would have protected the valuable item just as well.
In plain words: serializable isolation, whether implemented via two-phase locking or serializable snapshot isolation, prevents every anomaly covered in this level, but it does so at a real cost: either upfront waiting, under locking, or occasional aborts and retries, under serializable snapshot isolation, as covered on the previous two pages. Applying this strictest level to every transaction in an application, including the many transactions that were never actually vulnerable to write skew or phantoms in the first place, pays that cost everywhere for a benefit that most of those transactions did not need.
A worked example. A dashboard query that only reads data and never checks a cross-row invariant before writing gains nothing from serializable isolation that read committed or repeatable read would not have already provided, while still paying serializable's extra cost if applied anyway.
The key lines. No new SQL; this is a judgment call about where to apply the strictest isolation level, not a syntax decision.
Isolation-level overreach
Isolation-level overreach is applying the strictest isolation level, such as serializable, to transactions that were never vulnerable to the anomalies it specifically guards against, paying its real cost for no corresponding benefit.
Example: locking every door in a building all day to protect one valuable room is isolation-level overreach; locking just that room would have sufficed.