AnalyticDB for PostgreSQL is built on PostgreSQL and supports two connection pool tools: PgBouncer and pgpool-II. A connection pool sits between your application and the database, reusing existing database connections instead of opening a new one for each request. This reduces connection overhead, improves throughput under high concurrency, and lowers the load on the database server.
Choose a connection pool
The two tools serve different primary needs. Use the following table to decide which one fits your workload.
| PgBouncer | pgpool-II | |
|---|---|---|
| Primary strength | Lightweight connection pooling | Connection pooling with load balancing and query caching |
| Load balancing | No | Yes |
| Automatic retry | No | Yes |
| Query cache | No | Yes |
| Best for | High volumes of short-lived connections | Workloads that require load balancing, automatic retry, or query caching on top of pooling |
How connection pooling works
When your application opens a connection, it connects to the pool instead of directly to the database. The pool maintains a smaller set of long-lived database connections and lends one to each incoming request. After the request completes, the connection returns to the pool and becomes available for the next request. This lets your application handle many simultaneous requests with far fewer actual database connections.
PgBouncer
PgBouncer is a lightweight connection pooler for PostgreSQL. It manages and reuses database connections to reduce the overhead of repeatedly establishing connections between your application and the database, and improves concurrency performance.
For installation and configuration, see the PgBouncer documentation.
pgpool-II
pgpool-II is a connection pool middleware that adds load balancing, automatic retry, and query cache on top of standard connection pooling.
For installation and configuration, see the pgpool-II documentation.