pgBouncer: How Its Pooling Modes Really Handle Connections

When a comment mentions “narrowing down” the number of connections, that logic only fits transaction pooling, not session pooling. In session mode, every app connection maps one-to-one to a real backend connection on the database. So an app that spins up a massive connection pool will force the same massive number of connections on the database side.

Transaction pooling is where the real win shows up. It lets you run many more live app connections to pgBouncer than it holds open to the database, because an app connection that isn’t mid-transaction doesn’t need a dedicated database connection at all. That idle app connection simply waits without consuming a backend slot.