How to do it...

Let's begin with a few basic calculations. Look at these following numbers that represent an estimate of interface speed after accounting for overhead:

  • 1000 Mb/s * B/10 b = 100 MB/s
  • 10,000 Mb/s * B/10 b = 1,000 MB/s

 

Next, consider how many ways this will be distributed. If we have an existing PostgreSQL setup, follow these steps:

  1. Execute the following query to determine the number of existing replicas:
        SELECT count(1)+1 AS streams 
          FROM pg_stat_replication; 
  1. Multiply streams by 160 for maximum MB/s needed by replication streams.
  2. Execute the following queries together in a psql connection during a busy time of day on a production database:
 SELECT SUM(pg_stat_get_db_tuples_fetched(oid)) AS count1 FROM pg_database; SELECT ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.