How to do it...

Start by calculating the number of connections that the RAM can accommodate by following these steps:

  1. Begin the estimate with 8 MB used per connection.
  2. Add four times the value of the work_mem PostgreSQL configuration setting in megabytes, for a per-client total.
  3. Obtain the amount of RAM in megabytes.
  4. Divide half of the RAM size by the per-client MB total.

Next, calculate the number of connections the CPU and disk resources can support by following these steps:

  1. Obtain the CPU count in cores, including virtual if present.
  2. Double the CPU core count.
  3. Add the number of disk spindles.

Use the lower of the two values as the final ideal connection count.

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.