Postgresql – Does PgBouncer create a separate pool for every database config entry

database-designmax-connectionspgbouncerpostgresql

If I set up a pgbouncer.ini config file with several database entries, does pgBouncer create a separate pool for each one? I would think so, but have not been able to confirm this.

For example, with something like this:

[databases]
db1 = ...
db2 = ...

[pgbouncer]

.
.
.
max_client_conn = 480

default_pool_size = 250

Would I have a default pool of 250 for each DB and a max of 480, or a total of 250 default and max of 480 connections that are shared between both?

Thanks very much!

Best Answer

Yes, pgbouncer creates a separate pool for each database. You really don't want a pool size as big as 250 in a scenario like this - because that is 250 connections from pgbouncer to the postgres server for each database.

The max of 480 is the total number of connections from clients into pgbouncer, regardless of which database they go into.