Troubleshoot connection pooling issues in Aiven for PostgreSQL®
Discover the PgBouncer connection pooler and learn how to cope with some specific connection pooling issues.
If you use PGBouncer connection pooling,
verify your password encryption method compatibility
to ensure successful connections. You may need to migrate to SCRAM-SHA-256 to maintain
compatibility as the MD5 password encryption will be deprecated in PostgreSQL 19.
About connection pooling with PgBouncer
PgBouncer is a lightweight connection pooler for PostgreSQL® with low memory requirements (2 kB per connection by default).
PgBouncer offers several methods when rotating connections:
-
Session pooling: This is the most permissive method. When a client connects, it gets assigned with a server connection that is maintained as long as the client stays connected. When the client disconnects, the server connection is put back into the pool. This mode supports all PostgreSQL features.
-
Transaction pooling: A server connection is assigned to a client only during a transaction. When PgBouncer notices that the transaction is over, the server connection is put back into the pool.
warningThis mode breaks a few session-based features of PostgreSQL. Use it only when the application cooperates without using the features that break. For incompatible features, see PostgreSQL feature map for pooling modes.
-
Statement pooling: This is the most restrictive method, which disallows multi-statement transactions. This is meant to enforce the
autocommitmode on the client and is mostly targeted at PL/Proxy.