Choosing Your PgBouncer Pooling Mode

PgBouncer supports various “pool modes.” The pool mode specifies how a server connection may be re-used by clients.

Pool modes are listed as follows, ordered from the most aggressive level to the most conservative level. A more aggressive pool mode re-uses connections earlier, potentially achieving higher levels of concurrency at the cost of reduced compatibility with client side features.

Features like advisory locks are not compatible with all pool modes. You’re limited to session mode. Prepared statements were not compatible with PgBouncer until being added in version 1.21.0, a highly anticipated addition. Prior to that version, when using Ruby on Rails, prepared statements were often disabled due to ...

Get High Performance PostgreSQL for Rails 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.