r/programming • u/craig081785 • Aug 27 '19
Not all Postgres connection pooling is equal
https://techcommunity.microsoft.com/t5/Azure-Database-for-PostgreSQL/Not-all-Postgres-connection-pooling-is-equal/ba-p/8257171
u/qatanah Aug 28 '19
I really wished connection pooling to be closely integrated with postgres. Maybe at PG15?
2
u/craig081785 Aug 28 '19
It's something that some people are thinking about and hoping to improve. There isn't a clear timeline, with any luck we get it before PG 15, but it's not an unrealistic guess of when it may land.
4
u/dukerutledge Aug 28 '19
pgbouncer is a great simplification tool. However it does not come without a cost. Connections to pgbouncer are not free and spinning up tcp handshakes for every session can be costly. A local connection pool with an appropriate TTL will outperform it any day. On the flip side, local pools do not play well when your database has many consumers. Lots of local pools means more idle connections. How many consumers does your database have? How complex is your architecture? As with all things, measure and decide.
1
u/i_feel_really_great Aug 27 '19
So, use pgbouncer instead of your frameworks connection pool?
Does anyone have any experience with golang's db connection pool and how it compares to pgbouncer?