What is PgBouncer?

PgBouncer is a lightweight connection pooler for PostgreSQL. Marko Kreen wrote it at Skype, and Skype released version 1.0 in March 2007. It’s maintained by an open source community and published under the ISC license.

Each Postgres connection uses memory and a server process, so many clients connecting at once can strain the database. PgBouncer keeps a small pool of connections to Postgres and lends them to clients. It has three pool modes:

  • Session pooling: a client keeps one server connection for as long as it stays connected.
  • Transaction pooling: a client gets a server connection only for the length of a transaction.
  • Statement pooling: a client gets a server connection for a single statement.

On AWS, Amazon RDS Proxy is a managed connection pooler that does a similar job for RDS and Aurora.

What is PgCache?

PgCache is a transparent, wire-compatible caching proxy and smart read replica for PostgreSQL. It sits between your application and your database without requiring application code changes, and keeps its cache current through Postgres logical replication. Writes, and reads PgCache can't serve from cache, go to your database.

PgCache works with PostgreSQL 16, 17 and 18, including Amazon RDS and Aurora. It's source-available under the Elastic License 2.0.