On Thu, Jan 17, 2019 at 8:18 AM Nicola Contu <nicola.contu@gmail.com> wrote: > > Hello, > I am a bit confused about the settings in pgbouncer > > What's exactly the pool_size?
Roughly, the number of open connections pgbouncer will keep to PostgreSQL.
> If I set 3, and I tried to connect from 4 shells, I am still able to connect.
That would be the point - pgbouncer is sharing the 3 connections it keeps with PostgreSQL between the 4 client connections made to it.
> Same thing for max_db_connections. I set this to 1 and I am able to connect from 2 shells.
Same as pool_size but basically a fail-safe since pools are per-user/per-database while this limit is per-database only.
> This is kind of confusing and I'm not really cleared reading the documentation.
For each setting you need to understand whether it limits pgbouncer->PostgreSQL or client->pgbouncer
Configurations in [databases] limit the former; [pgbouncer] options either provide defaults for the [databases] or limit clients.
> max_db_connections=1 So one open connection max per database/user pool but it is shared - i.e., actively executing queries running in parallel are limited to this number.
> max_client_conn=5 > I just want to limit connections from the app etc.