-1

Connecting from .net application to PostgresDB. There are 20+ applications connecting. How many connection does postgre support in total.

Connection string sample:

"ConnectionString": "......... Pooling=true; Minimum Pool Size=50; Maximum Pool Size=200;"

In docs noticed its mentioned 100+15, But on some applications it have 50 Minimum pool already

  • 1
    Pooling is a clientside strategy, it doesn't affect the connection limit of the database itself. See https://stackoverflow.com/questions/44272459/postgres-npgsql-connection-pooling – Bergi Sep 26 '22 at 15:59
  • 1
    https://www.postgresql.org/docs/current/runtime-config-connection.html#GUC-MAX-CONNECTIONS –  Sep 26 '22 at 16:26
  • We have 250 JVM's and each one has a connection pool of 10 connections. 10 connections to the connection pool we have put in front of the database to avoid direct connections from the applications. The database has a maximum of just 50 connections and that is more than enough for the 5 million daily users we serve. So instead of a maximum of 2500 connections, we have just 50. And when really busy, there are just 12 to 15 active connections, the rest is idle. – Frank Heikens Sep 26 '22 at 17:55

1 Answers1

2

The limit on the server size is determined by max_connections - superuser_reserved_connections (both of which are PostgreSQL parameters). The default value is 97. In addition, you can set a connection limit on the database and the database user.

However, if you are even getting close to the limit of 97 connections, you are probably doing something wrong: either you have no connection pool, or the connection pool is defined too large. Only very powerful hardware could handle hundred active processes.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263