3 places
Explainer · 25 Nov 2026 (Pacific)

Where each kind of data lives when our apps run in 3 regions

What this is
This explainer checks a simple rule for placing app data in 3 regions against the design we tested, scenario by scenario.
Why it exists
Is it not simple: local data in the regional database, data that one owner writes and others read shared, and everything else global, even if a little slower? What is wrong with that, what are foreign keys for, and how does each scenario play out?
Length
8 short pages; the last one is where you decide.
The situation

Our apps will run in 3 regions, and every row needs one home

Today each app runs in one place, with one database. A person far away waits on every tap.

We plan to run in 3 regions. A region is a place that holds a full copy of the app. The tests used US West, Singapore and Frankfurt. Each person gets a home region at sign-up, the region nearest to that person. Each region has its own regional database. Programs of that region reach it in under a millisecond.

Distance is the problem. One question and answer between 2 regions is an ocean trip. In our tests one ocean trip took 146 to 187 ms. Measured, simulated distance

All tests ran on one machine. The distance between regions was added on purpose. So timings are a guide, and counts are the point.

Our examples use 3 people. Ana lives in Singapore. Ben lives in US West. Dan lives in Frankfurt.

Two models

Two ways to place the data are on the table

Both models agree on private data. They differ on data that several people write.

Both use shared tables. One owner writes a row at home. Postgres copies the row to every region. A copy arrives 74 to 98 ms later. Measured, simulated distance

The first model adds one global database: a single Postgres for the whole world, in one region. We call that model the 3-place rule. Private data is regional. Owner-written data is shared. Everything else is global. The second model is the call design, the one we tested. A thing that several people write lives in its owner's regional database. Other regions reach it by a call.

This table shows where 4 kinds of data live in each model:

The 2 models differ in row 3 only.
Kind of data3-place ruleCall design
Only the person writes and reads it (habits)Regional databaseRegional database
One owner writes, others read (profile, posts)Shared tableShared table
Several people write one thing (seats in a quest)Global databaseOwner's regional database, by a call
Must be unique in the world (a username)Global databaseGlobal database

So the whole question is row 3: where do seats and paid joins live?

The answer

The 3-place rule works; it trades speed far away for simpler code

The 3-place rule is sound. We recommend it with 3 guard rules. It removes the calls between regions. It keeps every hard choice inside one database.

These 3 numbers frame the trade:

0.3 ms
for one write in the own regional database
Measured
187 ms
for one write from Singapore to a global database in US West
Measured, simulated distance
6costs
of the 3-place rule, against 3 things it removes

A far write is about 600 times slower than a local one. That is the price of "everything else global".

The 3 guard rules keep the price small:

  1. A write to the global database is one statement: one command to the database. So it costs one ocean trip.
  2. A row with one clear owner stays in a shared table. Likes, results and friend rows have one owner.
  3. Private data never enters the global database.

With these guards the global database holds only limits and unique names.

The whole argument, in order:

The story in short
  1. Our apps will run in 3 regions, and each person's data lives in that person's home region.
  2. A simple rule places all data in 3 places: the regional database, shared tables copied to every region, and one global database for everything else.
  3. The rule works, and it is simpler than the design we tested, which sends a call to the owner's region instead of using a global database.
  4. The rule has 6 costs; the biggest is that a write from a far region waits about 0.2 seconds, and an action that touches 2 databases is not one transaction.
  5. A foreign key makes the database refuse a broken link, but only when both rows live in one database.
  6. So every link that crosses databases is a weak ref in both models, kept right by 5 small parts that we tested.
  7. We walked 8 scenarios through both models; posts, likes, friends and group quest days need no global database at all.
  8. Only limits and unique names need one place that decides, and paying gems for a seat needs 3 steps in both models.
  9. The call design ran on one machine with simulated distance; the 3-place rule never ran, so every number for it is an estimate.
  10. We recommend the 3-place rule with 3 guard rules, and 3 questions settle the rest.

The map of the pages:

  • 6 costs: what the 3-place rule removes, and what it costs.
  • Foreign keys: what a foreign key does, and where it stops working.
  • Strong and weak: which link needs which kind, and the 5 parts of a weak ref.
  • Posts and friends, Seats and gems, Delete and failures: 8 scenarios, step by step, in both models.