I am using PostgreSQL with PgBouncer, and receive the following error in my application:
08P01: no more connections allowed (max_client_conn)
pgbouncer.ini has the following configuration:
max_client_conn = 100
default_pool_size = 20
pool_mode = session
postgresql.conf has:
max_connections = 100
The PostgreSQL server has 5 databases that are accessed by a single user.
My understanding is that max_connections
should be equal to (default_pool_size * # databases)
, and that max_client_conn
should be at least this much. I have also seen the comment in the pgbouncer.ini that the default_pool_size
should be equal to the max_client_conn
if using session pooling.
So to resolve this error I am encountering, should I simply set default_pool_size = 100
? Or increase just the max_client_conn
? Or something else?