O'Reilly logo

Heroku Cookbook by Mike Coutermarsh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a follower for read-only DB queries

As an application grows, the database is typically one of the largest performance bottlenecks. The first step in horizontally scaling a database is to enable replication to a follower database. When we enable a Postgres follower, all writes to the master database are streamed to the follower. This gives us a read-only replica of all our data. We can then reduce the load on our primary database by directing read-only queries to a follower database. This frees up resources on our master database to handle writes.

Note

Replication lag is the delay between the write to the primary database and this data's availability on the follower. We need to be aware that there might occasionally be a second delay before ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required