Setting up a connection pool
A connection pool is a term used for a collection of already connected sessions that can be used to reduce the overhead of connection and reconnection.
There are various ways by which connection pools can be provided, depending on the software stack in use. Probably, the best option is to look at the server-side connection pool software because that works for all connection types, not just within a single software stack.
Here, we're going to look at PgBouncer, which is designed as a very lightweight connection pool. The name comes from the idea that the pool can be paused and resumed to allow the server to be restarted, or "bounced".
Getting ready
First of all, decide where you're going to store the PgBouncer parameter ...
Get PostgreSQL 9 Administration Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.