PgCat pooler

PgCat logo

PgCat is PostgreSQL connection pooler and proxy which scales PostgreSQL (and PostgresML) databases beyond a single instance.

It supports replicas, load balancing, sharding, failover, and many more features expected out of high availability enterprise-grade PostgreSQL deployment.

Written in Rust using Tokio, it takes advantage of multiple CPUs and the safety and performance guarantees of the Rust language.

PgCat, like PostgresML, is free and open source, distributed under the MIT license. It's currently running in our cloud, powering both Serverless and Dedicated databases.

Features

PgCat implements the PostgreSQL wire protocol and can understand and optimally route queries & transactions based on their characteristics. For example, if your database deployment consists of a primary and replica, PgCat can send all SELECT queries to the replica, and all other queries to the primary, creating a read/write traffic separation.

PgCat architecture
PgCat deployment at scale

If you have more than one primary, sharded with either the Postgres hashing algorithm or a custom sharding function, PgCat can parse queries, extract the sharding key, and route the query to the correct shard without requiring any modifications on the client side.

PgCat has many more features which are more thoroughly described in the PgCat features section.

Installation

PgCat is open source and available from our GitHub repository and, if you're running Ubuntu 22.04, from our Aptitude repository. You can read more about how to install PgCat in the installation section.

Configuration

PgCat, like many other PostgreSQL poolers, has its own configuration file format (it's written in Rust, so of course we use TOML). The settings and their meaning are documented in the configuration section.