Global Read Replicas


Enterprise Only Feature's global read replica feature provides near-real-time read-only versions of your data around the globe, securely distributed across multiple cloud providers and multiple regions. By enabling this feature, you can markedly reduce latency and increase throughput on all your read and write operations. And, because is serverless, each replica will autoscale with demand in each region, too. If you have deployed software around the globe, it will have fast connections to

Setting up read-replicas couldn't be easier: Toggle one checkbox and connect via instead of

Enabling Read Replicas

Navigate to the database for which you want read replicas and goto the "Config" tab (shown below). Toggle the "Global Read Replicas" setting (circled in red) to on.


If you do not see the Global Read Replicas option, contact [email protected] to opt-in to the beta.

Connecting to Read Replicas

After enabling read replicas, you can can create a read-only connection by replacing with in your connection parameters. That's all you need!

👍 automatically selects the closest replica

When you connect to, dynamically routes your connection to the closest read replica.

When should I use read-replicas?

Generally, read replicas are best used to either (1) reduce latency on reads or (2) remove load from your primary. With serverless, the major benefit is reduced latency because automatically scales up your primary as load increases.

In most cases, read replicas are a strict benefit -- they reduce latency and increase throughput. However, there are several situations in which's configuration of read replicas are not appropriate or have tradeoffs:

  • Your reads must be always and exactly up-to-date -- If you need to be perfectly up-to-date, you must directly connect to the primary as necessary.


Monitoring replication lag

You can check the lag on the read replica by running: select pg_current_wal_lsn() on the primary ( and select pg_last_wal_receive_lsn() on the replica ( at the same time and comparing the LSNs. For more detail, review " Monitoring" in

  • You need to run long-running, read-only queries queries on a very active database -- these queries will likely be cancelled so that the read replica can accommodate data updates that it receives from the primary.

How should I use read replicas?

There are two general connection strategies. In either case, establish two connections to one to the primary ( and one to the replica ( Then, do one of the following strategies:

  1. Routing-based: If you or your application can determine in advance which queries will be read-only, route your queries over the appropriate connection. Those queries will run faster and help increase throughput.

  2. Retry-based: If you or your application cannot determine in advance which queries will be read-only, then first run your queries over the replica and if they fail, try again on the primary. Do not forget that the replica may have a slight lag from the primary and the delay in retry may impact your application or the data may be stale. If your use-case cannot tolerate or risk that retry delay, then this strategy is not appropriate.

Finally, ensure that you do not read information from the replica and use that as part of an open transaction with the primary -- the replica may lag behind the primary and using stale information may lead to inconsistencies. Instead, read from the primary inside the same transaction.

Technical Details's read replication feature is built on top of postgres' warm standby log shipping functionality with asynchronous streaming replication enabled. The technical limitations of the feature are detailed in In short, it's read only and you will get errors if you try write operations.

You can determine if you're connected to a read replica by running SHOW in_hot_standby or checking whether the host of your connection is

Currently, all read replicas are configured for high TPS, short-running queries. In general, we see a <1s lag between changes on the primary and their appearance in the replica. If your use-case is particularly sensitive to lag, we recommend running SHOW [parameter name] to get the parameters in and reviewing these settings as they will describe the replication functionality.

Known Limitations
Beyond, replicas that are unused after 72 active primary hours will have slower initial startup on first connection. That is, once the primary is active for 72 hours while the replica is not, the subsequent first connection to the replica will be slower while it warms back up.

Beta Limits

Supported Geographies:

  • North America
  • Southeast Asia