Skip to content
Install

A read replica is a standby Postgres instance that streams changes from the primary and serves read-only queries. Use replicas for read-heavy workloads, analytics queries that should not compete with production traffic, and reporting tools that must not write.

To add a standby, refer to Configure high availability.

A database has one endpoint for each kind of traffic. Select one in the Connect dialog under Primary, Standbys, or Any.

Connect optionHost prefixServes
Primarypg-<name>-rwReads and writes. The endpoint follows a failover.
Standbyspg-<name>-roReads only, load-balanced across standbys.
Anypg-<name>-rReads only, across every instance.

Point your app’s main connection at -rw, and read-only consumers at -ro. A write to -ro fails.

flowchart LR
APP[Your app] -->|reads + writes| RW[["pg-name-rw"]]
RPT[Reporting / analytics] -->|reads only| RO[["pg-name-ro"]]
RW --> P[(Primary)]
RO --> S1[(Standby 1)]
RO --> S2[(Standby 2)]
P -.->|stream| S1
P -.->|stream| S2
Writes reach only the primary. The -ro endpoint spreads reads across standbys.

A row written to the primary can take time to appear on a standby. A read from -ro after a write can return old data. Code that reads its own writes must use -rw.

The replication mode sets whether a commit waits for a standby. The default is Async. For the other modes, refer to Choose a replication mode.

Each standby is a full copy of the database, with the same storage, CPU, and memory. A primary with two standbys uses about three times the resources of a single instance.