0Pricing
SQL Academy · Lesson

Read Replicas and Connection Routing

Route read-only traffic to replicas with PgBouncer or a smart driver, and accept the staleness trade-off.

Why Read Replicas?

Read-heavy workloads can offload SELECTs to replicas:

  • Primary handles writes
  • Replicas handle most reads
  • Horizontal read scaling without sharding

Eventual Consistency Caveat

Replicas lag the primary. A user that just placed an order may not see it on the replica yet. Either:

  • Route reads-after-writes to the primary
  • Wait for replica catch-up
  • Cache the post-write state in the app

All lessons in this course

  1. Streaming Replication and WAL
  2. Logical Replication for Sharding
  3. Failover and Leader Election (Patroni, Stolon)
  4. Read Replicas and Connection Routing
← Back to SQL Academy