Quick revision
The short answer
I would use region-aware placement: rows of EU users are pinned to EU regions with row-level geo-partitioning, US and Asia rows to their regions, so residency rules are met and each user's reads and writes stay local and fast. Reference data becomes global tables replicated everywhere, with fast local reads and slower writes. Transactions that span regions pay cross-region round trips of roughly 70 to 200 ms, so the design keeps most transactions inside one region, and we plan for region failure explicitly. To the business I present cost, latency per operation, compliance and the skills needed, next to simpler options such as per-region databases behind a routing service.
What to remember
In this answer, we designed a multi-region active-active account database with distributed SQL. Row-level geo-partitioning pins each user's rows to their home region, meeting EU residency and keeping reads and writes local, while global tables replicate reference data for fast reads everywhere. Cross-region transactions pay 70 to 200 ms, so the domain keeps most transactions in one region. Survival goals decide how many regions hold each data set and what happens when a home region fails, and the trade-offs are presented next to the simpler option of per-region databases with routing.
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 use region-aware placement: rows of EU users are pinned to EU regions with row-level geo-partitioning, US and Asia rows to their regions, so residency rules are met and each user's reads and writes stay local and fast. Reference data becomes global tables replicated everywhere, with fast local reads and slower writes. Transactions that span regions pay cross-region round trips of roughly 70 to 200 ms, so the design keeps most transactions inside one region, and we plan for region failure explicitly. To the business I present cost, latency per operation, compliance and the skills needed, next to simpler options such as per-region databases behind a routing service.
Why this question is asked
Multi-region active-active sounds like one feature, but it bundles several hard requirements: low latency for users on three continents, writes accepted everywhere, legal limits on where EU data may live, and survival of a region outage. Distributed SQL databases offer tools for each, and each tool has a cost in latency, money or complexity. Interviewers ask this design question to see whether we can match the tools to the requirements and explain the trade-offs to non-engineers. In this answer, we will set out the requirements, pin user data to home regions, handle global reference data, deal with cross-region transactions and region failure, and then compare the design with a simpler alternative.
1The Requirements Behind 'Active-Active'
Users in the US, EU and Asia should read and write their accounts with low latency, say under 20 ms at the database for a typical request. All regions accept writes. EU users' personal data must be stored only in EU regions, which is a legal requirement and not a performance wish. And the system should keep working if one region fails, with clear rules for what happens to the data that lives there.
Physics sets the boundaries. A round trip between Frankfurt and Virginia is about 90 ms, between Virginia and Singapore around 200 ms, and Frankfurt to Singapore about 150 to 170 ms. Any write that must be confirmed by replicas on two continents pays at least one such round trip. So the core of the design is keeping each user's consensus group inside the user's region.
2Pinning User Rows to Their Home Region
Distributed SQL databases such as CockroachDB and YugabyteDB support row-level geo-partitioning: a column such as region decides where each row's replicas live. In CockroachDB's multi-region SQL this is a REGIONAL BY ROW table, with a hidden or explicit crdb_region column; YugabyteDB uses tablespaces with placement policies per partition. Syntax differs per product, so check your version; the idea is the same.
5 messages in order. Play them, or step through them one at a time.
No message crosses the Atlantic; the US node holds no copy of EU personal data.
With replicas of EU rows only in EU regions, the consensus group for those rows is entirely in Europe, so writes commit in a few milliseconds for European users, and the data never leaves the EU at rest. Notice that residency is about more than storage: backups, logs, analytics exports and support tools must also respect it, and the region of a row must be decided when the account is created and changed only through a deliberate migration. Including the region in queries, or in the key, lets the database go straight to the local replicas without checking other regions.
3Global Tables for Reference Data
Some data is read everywhere and changes rarely: currencies, product plans, country lists, feature flags. Distributed SQL offers global tables for this, such as CockroachDB's GLOBAL locality, which keeps a readable replica in every region. Reads are fast and local everywhere. The price is on writes, which must coordinate across regions and can take hundreds of milliseconds. That is fine for data that changes a few times a day. Personal data never goes into global tables, because that would copy it out of its residency region.
4Keeping Transactions in One Region
A strongly consistent transaction that touches rows homed in two regions, for example a transfer from an EU customer to an Asian one, must coordinate both consensus groups and pays cross-region round trips, often 70 to 200 ms or more per commit. A design where many requests do this will feel slow everywhere. So we shape the domain so that almost all transactions touch only one user's rows, and therefore one region. Cross-region operations become rare, explicit and asynchronous where possible, for example an outgoing transfer recorded in the sender's region and an event that credits the receiver in theirs.
In the Spring application, each region runs its own instances, connected to local database nodes, and the routing layer, often DNS or a global load balancer, sends each user to their home region. If a user travels, they still reach their home region, accepting extra latency, rather than moving their data.
5Planning for Region Failure
We must decide the survival goal. With replicas of EU rows in three zones of one EU region, the system survives a zone failure but not the loss of the whole region. Surviving a region failure needs replicas in at least three regions, with a majority surviving any one loss, which for EU data means three EU regions, for example Frankfurt, Belgium and Paris, if residency requires all copies in the EU. More regions mean higher cost and slower writes, since a majority now spans cities. CockroachDB expresses this as SURVIVE ZONE FAILURE or SURVIVE REGION FAILURE; other products use replication factor and placement settings.
We also say clearly what happens to pinned data if its home region is down and the survival goal is zone level: EU accounts become unavailable until the region returns, while US and Asian users are unaffected. That is often acceptable for a few hours of rare outage, but it must be a business decision written down, not a surprise.
6Presenting the Trade-Offs
For the decision makers, I would put the distributed SQL design next to a simpler alternative: a separate PostgreSQL database per region, each with its own HA, and a routing service that maps each user to their region. The simpler option meets residency just as well and has single-node latency, but cross-region operations and global reports become application work, and each region is operated separately.
| Concern | Distributed SQL, geo-partitioned | Per-region databases + routing |
|---|---|---|
| Residency | Rows pinned by region column | Each database stays in its region |
| Local latency | A few ms within region | Sub-ms to a few ms |
| Cross-region transactions | Supported, 70 - 200 ms | Application-level (sagas, events) |
| Region failure | Survivable with 3+ regions per data set | Per-region HA; data in a lost region waits |
| Cost and skills | Licence or service, new skills | Familiar engine, more custom routing |
7Follow-up questions
How do you handle a user who moves from the EU to the US?
Changing the region column moves the row's replicas, but residency may require consent or legal review first, so it should be an explicit account migration with an audit record, not an automatic update when they log in from a new country.
What about read latency for users far from their home region?
Their reads go to the home region, so a European user travelling in Asia sees an extra 150 ms or so. Some products offer follower or stale reads from nearby replicas, but for EU data there are no replicas outside the EU, so that option is not available for personal data.
Can a global table hold user-visible counters such as total sign-ups?
It can, but every increment would be a slow cross-region write. Better to keep regional counters and sum them on read, or compute the total asynchronously.
8Conclusion
In this answer, we designed a multi-region active-active account database with distributed SQL. Row-level geo-partitioning pins each user's rows to their home region, meeting EU residency and keeping reads and writes local, while global tables replicate reference data for fast reads everywhere. Cross-region transactions pay 70 to 200 ms, so the domain keeps most transactions in one region. Survival goals decide how many regions hold each data set and what happens when a home region fails, and the trade-offs are presented next to the simpler option of per-region databases with routing.
Open with
I would design around keeping each user's data, and each user's transactions, in their home region. With a distributed SQL database like CockroachDB or YugabyteDB, the account tables are geo-partitioned by row: a region column decides where the replicas live, so EU users' rows have all their replicas in EU regions.
Then, if they want more
That satisfies residency at rest, and because the consensus group is entirely in Europe, an EU user's write commits in a few milliseconds. US and Asian users work the same way in their regions. Each region runs its own application instances and users are routed to their home region.
Reference data like plans, currencies and feature flags goes into global tables replicated everywhere, so reads are local and fast, and the slower cross-region writes are fine because they are rare. Personal data never goes there.
The key trade-off is that strongly consistent transactions spanning regions pay round trips of roughly 70 to 200 ms, so I would design the domain so almost all transactions stay within one user's data, and make cross-region operations explicit and often asynchronous.
For failure, I would agree a survival goal: zone failure is cheap, but surviving loss of a whole region needs replicas in three regions per data set, which for EU data means three EU regions, and higher cost and latency.
I would present all of that, with cost, per-operation latency, compliance and the skills needed, next to the simpler option of one PostgreSQL per region behind a routing service.
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 company needs a multi-region active-active database for customer accounts, with...": https://scrivio-interview-library.netlify.app/databases/partitioning-and-sharding/c00f03d638/