PgCat vs SPQR
PgCat
github.comSPQR
docs.pg-sharding.techSide by side
| Figure | PgCat | SPQR |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Linux | Yes | Yes |
| API | — | Yes |
| Self-hosted | Yes | Yes |
| Plans published | 1 | 1 |
| Spec score · Database Proxy Software | 7.6 (#15) | 7.8 (#9) |
| Deployment | The project documents Docker deployment and publishes ghcr.io/postgresml/pgcat:latest. | The getting-started guide provides a Docker image and lists router, admin console, and gRPC API ports as 6432, 7432, and 7000. |
| License | PgCat is free and open source under the MIT license. | The source is distributed under the PostgreSQL Global Development Group License. |
| Maker | PostgresML was founded in 2022 by engineers who built Instacart’s machine learning platform. | The documentation says SPQR was designed by the Data Platform team of Yandex.Cloud. |
| Security | Clients and PostgreSQL servers can use SSL/TLS, and authentication supports MD5 and SCRAM-SHA-256 connections. | The docs show PostgreSQL connections configured with SSL modes including require and verify-full. |
Plans
In their own words
PgCat
PgCat is a free, open-source PostgreSQL pooler and proxy for self-hosted Linux deployments. Its stable features include transaction and session pooling. Read queries can be balanced across replicas and the primary, while health checks detect broken replicas and redirect queries to remaining servers. PgCat uses Tokio’s asynchronous runtime and a multithreaded design for multicore machines. Operators can view pooler statistics through the pgcat and pgbouncer admin databases or a Prometheus HTTP endpoint. Client and PostgreSQL server connections can use SSL/TLS, with MD5 and SCRAM-SHA-256 authentication supported. MD5 passthrough can use auth_query so cleartext passwords need not be stored in the configuration file. Docker deployment is documented, and a container image is published. Sharding syntax, comment parsing, automatic sharding, and mirroring are experimental. Transaction mode is enabled by default and does not support prepared statements, SET, or advisory locks. The project describes PgCat as stable and says it serves high query volumes in production. It is licensed under MIT.
SPQR
SPQR is a self-hosted query router for horizontally scaling PostgreSQL through sharding. It can extract a sharding key from a query and route it to the relevant key range and shard when possible; keys can use one column or several. Queries can also specify a key or shard in a SQL comment. Applications connect using the PostgreSQL protocol, and the router and coordinator provide administrative consoles accessible through psql. SPQR supports one-phase and two-phase commit strategies; two-phase commit provides atomicity across shards and requires max_prepared_transactions greater than zero on each shard. The system can move data between shards to balance workload, and the project describes reducing transferred ranges to limit locking impact. Its documentation includes Docker and configuration-file deployment instructions. SPQR is free and distributed under the PostgreSQL Global Development Group License. The FAQ cautions that it is not suited to complex cross-shard queries, transactions modifying multiple shards or OLAP workloads, and reports a roughly 10–30% performance drop versus vanilla PostgreSQL depending on workload.