Confusion about MPG connection limits

Hey folks, I am trying to tune my active pool connections etc for Ecto. On the Connect page it details some connection limits:

But then the Metrics page details different ones:

I would like to understand that disparity. How many connections do I have access to?

Separately I just found this guide Phoenix with Managed Postgres · Fly Docs and it suggests setting the pool connection relatively low (8). If I want to maximize throughput of the app why would I not use all more connections (say, 30/50)?

Thanks for the question! The Connect page only showsPgBouncer settings currently: your cluster can accept up to 200 client connections from your apps, and will open up to 50 connections to Postgres. The Metrics page shows actual usage; but database connections there is Postgres’s own max_connections setting, not PgBouncer’s.

The reason Postgres allows 100 while PgBouncer only uses up to 50 is to leave headroom for direct connections, admin tasks, the reserve pool, and internal processes. So you effectively have access to 200 client connections through the pooler, which multiplex down to at most 50 actual Postgres connections.

2 Likes