Quick revision
The short answer
I would define tiers by how much committed data each kind of service may lose (its RPO) and how available it must be: zero loss for payments, a few seconds for chat, minutes for analytics events and sessions. The zero-loss tier uses synchronous_commit = on with synchronous replication to at least one standby in another zone, configured as a quorum with synchronous_standby_names = 'ANY 1 (...)', or remote_apply where reads on the standby must see the commit. Lower tiers use asynchronous replicas and, for non-critical writes, synchronous_commit = off per transaction. The tiers live in the platform catalogue and provisioning templates, and failover and point-in-time recovery are tested regularly.
What to remember
In this answer, we saw that durability tiers should be defined by acceptable data loss and availability, agreed with data owners, and then mapped to settings. The zero-loss tier uses local flushes plus a quorum of synchronous standbys across zones, with remote_apply where standby reads must see commits. Lower tiers use asynchronous replicas with lag alerts and per-transaction synchronous_commit = off. Synchronous replication adds commit latency and can block writes, so we use quorums within a region, and we make tiers part of provisioning, drift checks and regular failover and recovery tests.
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 define tiers by how much committed data each kind of service may lose (its RPO) and how available it must be: zero loss for payments, a few seconds for chat, minutes for analytics events and sessions. The zero-loss tier uses synchronous_commit = on with synchronous replication to at least one standby in another zone, configured as a quorum with synchronous_standby_names = 'ANY 1 (...)', or remote_apply where reads on the standby must see the commit. Lower tiers use asynchronous replicas and, for non-critical writes, synchronous_commit = off per transaction. The tiers live in the platform catalogue and provisioning templates, and failover and point-in-time recovery are tested regularly.
Why this question is asked
When every team picks its own durability settings, two kinds of mistakes coexist: payments running with asynchronous commit because someone wanted a faster benchmark, and analytics paying for synchronous replication they do not need. Interviewers ask this design question to see whether we can turn low-level settings into a policy expressed in business terms. In this answer, we will recap the two knobs that matter, define tiers in terms of acceptable loss, map each tier to settings, look at the costs and failure modes of synchronous replication, and make the tiers part of how databases are provisioned.
1A Quick Recap: Two Knobs
Durability against the loss of a server has two parts. Local durability is whether COMMIT waits for the WAL to be flushed on the primary's disk; that is synchronous_commit on or off. Replica durability is whether COMMIT also waits for one or more standbys to receive the WAL; that is synchronous replication, configured with synchronous_standby_names. Without it, replication is asynchronous: commits return before standbys have the data, and a failover after losing the primary can lose whatever the standbys had not yet received, usually under a second but more if they were lagging.
synchronous_commit has levels for the standby side too: remote_write waits until the standby has written the WAL to its operating system, on waits until the standby has flushed it, and remote_apply waits until the standby has replayed it, so that a read on that standby sees the change.
2Defining Tiers by Acceptable Loss
Tiers should be defined in terms the business understands, not in parameter names. The key number is the recovery point objective, RPO, the maximum amount of committed data we accept losing in a failure, together with the availability we need and the latency we can afford. We then classify each data set with its owners.
Payments and ledgers cannot lose an acknowledged transaction, so their RPO is zero even when a whole zone fails. Chat messages are important but a few seconds of loss in a rare zone failure is acceptable if clients resend. User sessions and analytics events can lose minutes; the user logs in again, or a dashboard is slightly off. Writing these down with the owners is the real work of the design.
| Tier | Example data | RPO | Settings |
|---|---|---|---|
| T0 zero loss | payments, ledger | 0, survives a zone | sync commit on, quorum sync replica in another zone |
| T1 seconds | chat messages, orders in flight | a few seconds | sync commit on, async replicas, lag alerts |
| T2 minutes | sessions, analytics events | minutes | async replicas, synchronous_commit off allowed |
| T3 rebuildable | caches, derived tables | data can be rebuilt | unlogged or single instance, backups optional |
3Settings for the Zero-Loss Tier
For T0 the primary flushes WAL locally and waits for at least one standby to flush it too before COMMIT returns. We use a quorum rather than naming one standby, so that any one of two or more standbys in different zones can confirm the commit. Then a single standby being slow or down does not stop writes, and a zone failure still leaves a standby with every committed transaction to promote.
If applications read from standbys and need to see their own writes immediately, for example a payment confirmation page served from a replica, we use remote_apply, which waits until the standby has replayed the commit. It costs more latency, so we apply it only where read-your-writes on replicas is needed, or route those reads to the primary instead.
7 messages in order. Play them, or step through them one at a time.
The slower standby does not delay the commit; losing zone A still leaves B with every committed transaction.
4Settings for Lower Tiers
T1 and T2 use asynchronous replicas, which add no commit latency. We monitor replication lag and alert when it exceeds the tier's RPO, because lag is exactly what would be lost in a failover. For T2 we also allow synchronous_commit = off, but per transaction or per role rather than for the whole server. That matters because services of different tiers often share a database: a service can write analytics events with SET LOCAL synchronous_commit = off while its payments in the same database stay fully durable.
T3 data, such as caches and derived tables that can be rebuilt from other sources, can use unlogged tables or simple single-instance setups. The rule is that rebuilding it must be automated and tested; otherwise it is not really T3.
5What Synchronous Replication Costs
Every T0 commit waits for a network round trip to another zone plus the standby's flush. Within a cloud region that is typically around one to a few milliseconds, which is fine for payments but adds up for services that commit thousands of small transactions per request path. Across regions it can be tens of milliseconds, so we keep synchronous standbys in the same region, in other zones, and use asynchronous replication for disaster recovery in another region, accepting a small RPO for the region-loss case and documenting it.
The second cost is availability. If the required number of standbys cannot confirm, commits wait, which means writes stop. With ANY 1 of two standbys in different zones, we need both standbys to be unavailable before that happens, and the failover tooling, such as Patroni, must manage the synchronous set as nodes come and go.
6Making Tiers Part of the Platform
A policy only works if it is the easy path. The tier is a required field in the platform catalogue for every database and data set, owned by a named team. Provisioning templates, Terraform modules or the operator for PostgreSQL clusters, create the right topology and settings from the tier, so nobody hand-edits synchronous_standby_names. Configuration drift checks compare running settings with the declared tier and alert on differences, for example a T0 database with no synchronous standby.
And we test. Every quarter we fail over each T0 cluster in a controlled way, verify that no acknowledged transaction is missing, and restore a point-in-time backup into a scratch environment to prove the backups and WAL archive work. The results go into the catalogue, so the tier is a tested claim, not a label.
7Follow-up questions
How do you prevent a synchronous standby outage from stopping all writes?
Use a quorum such as ANY 1 of at least two standbys in different zones, so one standby failing never blocks commits, and let the failover manager maintain the synchronous set. Some teams allow automatic fallback to asynchronous replication when no standby is available, but that silently changes the RPO to non-zero, so for T0 it must be an explicit, alerted decision rather than a default. Monitoring of standby health and lag gives warning before the quorum is at risk.
Is synchronous replication a replacement for backups?
No. It protects against losing a server or a zone, but it replicates mistakes instantly, such as a wrong DELETE. Point-in-time recovery from base backups and the WAL archive is still needed for every tier that matters.
What is the difference between remote_write and on for a standby?
remote_write waits until the standby has written the WAL to its operating system, which survives a crash of the standby's PostgreSQL but not of its OS. on waits until the standby has flushed it to disk, which survives both. on is the right choice for zero loss.
8Conclusion
In this answer, we saw that durability tiers should be defined by acceptable data loss and availability, agreed with data owners, and then mapped to settings. The zero-loss tier uses local flushes plus a quorum of synchronous standbys across zones, with remote_apply where standby reads must see commits. Lower tiers use asynchronous replicas with lag alerts and per-transaction synchronous_commit = off. Synchronous replication adds commit latency and can block writes, so we use quorums within a region, and we make tiers part of provisioning, drift checks and regular failover and recovery tests.
Open with
I would start from the business question, not the parameters: how much committed data may each data set lose, its RPO, and how available must it be. Payments get zero loss even if a zone fails; chat can lose a few seconds; sessions and analytics events can lose minutes; caches and derived tables can be rebuilt.
Then, if they want more
For the zero-loss tier I would keep synchronous_commit on and add synchronous replication as a quorum, synchronous_standby_names set to ANY 1 of two standbys in different zones, so a commit waits for the local flush plus one remote flush, and one slow or failed standby does not stop writes.
Where the service reads from standbys and must see its own commit, I would use remote_apply or route those reads to the primary. The lower tiers use asynchronous replicas with lag alerts tied to their RPO, and for non-critical writes synchronous_commit off per transaction with SET LOCAL or per role, which works even when tiers share a database.
I would be explicit about costs: synchronous commits add a cross-zone round trip of a millisecond or so, cross-region sync is too slow so region loss is covered asynchronously with a documented RPO, and if the quorum cannot be met writes block.
Then I would make tiers a required field in the platform catalogue, generate settings from provisioning templates, alert on drift, and test failover and point-in-time recovery every quarter.
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 "Services in your organization store very different data: payments, user sessions...": https://scrivio-interview-library.netlify.app/databases/storage-internals/8d4d3919a2/