Quick revision
The short answer
There are four main options. Keep the single primary and accept the write latency while serving EU reads from a local replica with read-your-writes handling; partition data by home region so EU users' data lives in an EU primary; run multi-primary replication, which needs conflict resolution and careful key design; or move to a distributed SQL database such as CockroachDB, YugabyteDB or Spanner that places data by region and pays consensus latency only for cross-region transactions. Data residency laws may decide the question by requiring regional partitioning anyway.
What to remember
In this answer, we saw that 150 ms of extra write latency comes from transatlantic round trips that no tuning removes. We can accept it while serving reads from an EU replica with read-your-writes handling, partition users by home region for local writes, run multi-primary replication at the price of conflicts, or adopt distributed SQL with region-aware placement and slow cross-region transactions. Data residency rules may make home-region partitioning the answer on their own.
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.
There are four main options. Keep the single primary and accept the write latency while serving EU reads from a local replica with read-your-writes handling; partition data by home region so EU users' data lives in an EU primary; run multi-primary replication, which needs conflict resolution and careful key design; or move to a distributed SQL database such as CockroachDB, YugabyteDB or Spanner that places data by region and pays consensus latency only for cross-region transactions. Data residency laws may decide the question by requiring regional partitioning anyway.
Why this question is asked
The speed of light sets the floor here: a round trip between the US east coast and western Europe takes around 70 to 90 ms, and a write that needs two round trips, connect plus commit or a few statements, easily costs 150 ms. No tuning removes that. So the question is really about where data lives and who must agree before a write counts. Interviewers ask this to see whether we know the realistic options and can price each one honestly, because the most impressive-sounding option is rarely the cheapest that works. In this answer, we will look at where the 150 ms comes from, then go through each option with its costs, compare them side by side, and see how regulation can make the choice for us.
1Where the 150 ms Comes From
An EU user's request lands on a service in eu-west. Reads may already be served nearby, but every write must reach the primary in us-east. A single statement in autocommit mode is one round trip, about 75 ms. A typical transaction is more: BEGIN, one or two statements, COMMIT, each waiting for the previous one, so two or three round trips, which is where 150 ms or more comes from.
Before changing architecture, it is worth checking that cheap fix first. If the EU service sends several statements per transaction across the ocean, moving the transaction into a single call, a stored procedure or one batched statement, or letting a service in us-east perform the write on behalf of the EU service, can bring the cost down to one round trip. It does not get below that.
2Option 1: One Primary, Local Reads, Accept Write Latency
The simplest option keeps one primary in us-east and adds a read replica in eu-west. Most traffic in most products is reads, so EU users get fast pages, and only writes pay the transatlantic cost. The catch is replication lag: an EU user who saves something and immediately reloads may read the local replica before it has the change, so we need read-your-writes handling, for example by capturing the primary's WAL position after the write and only reading locally once the replica has replayed it.
The cost is small: one replica, some routing logic, and writes that stay slow. If writes are rare, such as profile changes or occasional orders, this may be entirely acceptable, and it keeps a single source of truth with no conflicts.
3Option 2: Partition Data by Home Region
If EU users mostly touch their own data, we can give each user a home region. EU users' rows live in a primary in eu-west, US users' rows in us-east, and each region's service writes locally. A routing layer, often based on the user or tenant id, sends each request to the right region. Both regions can still hold asynchronous replicas of each other for disaster recovery.
- Global routinguser or tenant id -> home region
- us-east service and primaryUS users' data, written locally
- eu-west service and primaryEU users' data, written locally
- Cross-region callsrare and explicit, such as global reports
- Async cross-region replicasfor disaster recovery only
5 layers, from the top down. Step through them one at a time.
The cost is in the edges. Operations that span users in both regions, such as a US user sending money to an EU user, or a global admin report, become explicit cross-region calls, often with sagas instead of one transaction. Moving a user between regions needs a migration procedure. Ids must be unique globally, so we use UUIDs or region-prefixed keys. But for many products, these cross-region operations are a small fraction, and the result is local writes for everyone with no conflict resolution.
4Option 3: Multi-Primary Replication
Multi-primary means both regions accept writes to the same data and replicate to each other, for example with bidirectional logical replication in PostgreSQL or commercial tools built on it. Writes are local and fast in both regions.
But there is a catch, and it is a big one. If a US and an EU request update the same row within the replication delay, both commits succeed locally and then conflict when they meet. Someone must decide which wins: last writer wins by timestamp, which silently drops one change, or custom merge logic per table. Inserts need keys that cannot collide, and sequences cannot be shared. Unique constraints across regions cannot be enforced at commit time. This option is workable for data that is naturally conflict-free, such as append-only events, and dangerous for balances, stock levels or anything with invariants.
5Option 4: Distributed SQL With Region-Aware Placement
Distributed SQL databases such as CockroachDB, YugabyteDB and Google Spanner split data into ranges, each replicated across nodes with a consensus protocol like Raft or Paxos. A write commits when a majority of a range's replicas agree. The trick for latency is placement: we can pin EU users' rows so that their leader and majority live in eu-west, and their writes then commit with local round trips only.
The costs are new technology and different performance. Transactions that touch rows homed in both regions pay cross-region consensus, often 100 ms or more. Placing a majority of replicas in one region means losing that region can make its data unavailable, unless we place replicas across three regions, which brings back cross-region latency for every write. Migration from PostgreSQL is substantial even when the database speaks a PostgreSQL-compatible dialect, and licence or cloud costs are usually higher.
6Comparing the Options and the Residency Question
Laid side by side, the options trade latency against complexity and cost.
| Option | EU write latency | Main cost |
|---|---|---|
| Single primary, local reads | 150 ms, reads fast | Read-your-writes logic |
| Home-region partitioning | Local | Cross-region operations, user moves |
| Multi-primary | Local | Conflicts, global keys, lost updates |
| Distributed SQL | Local if data homed in EU | New database, cross-region tx slow |
Before choosing, we should ask legal one question: do data residency rules, such as GDPR transfer requirements or customer contracts, require EU personal data to be stored in the EU? If so, a single us-east primary may be unacceptable regardless of latency, and home-region partitioning becomes the natural answer, because it gives both local writes and residency in one design. For most products I would start with option 1 if writes are rare and move to option 2 when they are not.
7Follow-up questions
Can we hide write latency with asynchronous processing?
Sometimes. If a write does not need to be confirmed instantly, the EU service can accept it, put it on a durable queue and return, with the actual database write happening in us-east a moment later. The user experience is fast, but the product must handle the delay, for example by showing the change optimistically and resolving failures later.
How would you migrate users to home regions?
Add a home_region column, route by it, and migrate tenants or users in batches: copy their data to the EU primary, briefly freeze writes for that user, copy the final changes, flip the routing entry and unfreeze. Doing it per user keeps each freeze to seconds.
Is last writer wins ever acceptable?
For data where losing one of two concurrent edits is harmless, such as a user's display preferences, yes. For anything financial or with invariants, no, because it silently drops a change with no error to anyone.
8Conclusion
In this answer, we saw that 150 ms of extra write latency comes from transatlantic round trips that no tuning removes. We can accept it while serving reads from an EU replica with read-your-writes handling, partition users by home region for local writes, run multi-primary replication at the price of conflicts, or adopt distributed SQL with region-aware placement and slow cross-region transactions. Data residency rules may make home-region partitioning the answer on their own.
Open with
The 150 ms is physics: each round trip from eu-west to us-east is around 75 ms, and a transaction usually needs two or more. First I would check we are not making it worse with chatty transactions, because batching into one round trip helps.
Then, if they want more
Then there are four options. One, keep the single primary, put a read replica in eu-west and handle read-your-writes, for example with an LSN token, so reads are fast and only writes are slow; cheap and conflict-free, fine if writes are rare.
Two, partition by home region: EU users' data lives in an EU primary, so their writes are local, and the cost is that cross-region operations like a transfer between a US and an EU user become explicit calls or sagas, plus global ids and a way to move users.
Three, multi-primary replication, which gives local writes everywhere but means conflicts when the same row changes in both regions, lost updates with last writer wins, and no cross-region unique constraints; only for naturally conflict-free data.
Four, distributed SQL like CockroachDB, YugabyteDB or Spanner, with rows homed in the EU committing locally, but cross-region transactions pay consensus latency and it is a big migration. I would also ask legal about data residency, because if EU data must stay in the EU, home-region partitioning is the answer anyway, and that is usually where I would end up.
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 "Your service runs in two regions, us-east and eu-west, with a single PostgreSQL primary...": https://scrivio-interview-library.netlify.app/databases/replication-and-ha/33638e4fe2/