PostgreSQL connection limit

Hi, is there a limit on the number of open connections that Aptible managed postgres databases will allow?

Does it vary based on instance size? Thank you.

The max_connections setting on the Database is what controls how many concurrent connections are allowed. The default max_connections for all Aptible PostgreSQL Databases is 250. You can find the default configuration in our public GitHub repo.

To get your the Database’s current max_connections you can run SHOW max_connections; and to update the value you can run ALTER SYSTEM SET max_connections = 1000; and aptible db:reload the Database to apply the change as described in our PostgreSQL Configuration documentation. The documentation also contains a list of settings that are autotuned based on the Database’s container size.

Note that if you have any replicas you should update them first or you’ll get the following error from the replica when the primary Database starts up.

FATAL:  hot standby is not possible because max_connections = 1000 is a
lower setting than on the master server (its value was 2000)