SPQR
SPQR is a self-hosted PostgreSQL query router for scaling databases horizontally through sharding.
What SPQR is
SPQR is a self-hosted PostgreSQL query router for scaling databases horizontally through sharding. It can extract a sharding key from a query and choose a matching key range and shard when possible. Keys can use one column or multiple columns, while SQL comments can specify a key or direct a query to a shard. Applications connect using the PostgreSQL protocol, and SPQR includes router and coordinator administrative consoles accessible through psql. It supports one-phase and two-phase commit strategies; two-phase commit provides atomicity across shards and requires max_prepared_transactions greater than zero on every shard. SPQR can migrate data between shards to balance workload, and the project says it has handled terabytes of data and 100K+ queries per second. It supports managed PostgreSQL services and names pgx and JDBC as compatible driver examples. SPQR is free and open source under the PostgreSQL Global Development Group License, with Docker and configuration-file deployment instructions. Its FAQ cautions against complex cross-shard queries, multi-shard modifying transactions, and OLAP workloads, and reports a roughly 10–30% performance drop versus vanilla PostgreSQL depending on workload.
Good
- Routes queries using single- or multi-column keys
- Supports managed PostgreSQL services
- Includes data migration between shards
- Free and open source under PostgreSQL license
Watch out
- Not suitable for complex cross-shard queries
- Not suitable for OLAP workloads
- FAQ reports a 10–30% performance drop versus vanilla PostgreSQL
Who it suits
SPQR suits PostgreSQL developers who want to avoid implementing sharding logic in their applications, especially for single-shard OLTP workloads. It is not aimed at OLAP workloads or complex cross-shard operations.
Verdict
SPQR provides PostgreSQL sharding with routing, balancing, and transaction strategies while keeping applications on the PostgreSQL protocol. Its documented workload limits and reported performance drop are important considerations.
Plans and prices
From SPQR's own pricing page, checked 11 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| SPQR | Free | Open-source PostgreSQL sharding software |
The facts
Each one read from SPQR's own pages, with the date it was checked.
What it does
- Automatic routing
- The router extracts a sharding key from a query and uses it to select the key range and shard when possible.checked 5 Oct 2026
- Data balancing
- SPQR migrates data between shards to balance workload and describes reducing the size of transferred ranges to minimize locking impact.checked 5 Oct 2026
- Deployment
- The getting-started guide provides a Docker image and lists router, admin console, and gRPC API ports as 6432, 7432, and 7000.checked 11 Oct 2026
- Distributed transactions
- SPQR offers one-phase and two-phase commit strategies; two-phase commit provides atomicity across shards and requires max_prepared_transactions greater than zero on every shard.checked 11 Oct 2026
- Integrations
- The FAQ says SPQR works with managed PostgreSQL databases including Yandex Managed PostgreSQL and AWS RDS, and names pgx and JDBC as compatible driver examples.checked 11 Oct 2026
- Intended users
- SPQR is presented as a fit for PostgreSQL developers who want to avoid application-level sharding logic and workloads suited to single-shard OLTP queries.checked 5 Oct 2026
- License
- The source is distributed under the PostgreSQL Global Development Group License.checked 11 Oct 2026
- Limits
- The FAQ says SPQR is not suitable for complex cross-shard queries, transactions that modify multiple shards, or OLAP workloads.checked 11 Oct 2026
- Managed PostgreSQL
- The product site says SPQR can use managed PostgreSQL services including AWS RDS, Google Cloud SQL, and Azure Database for its shards.checked 5 Oct 2026
- Performance
- The FAQ reports a roughly 10–30% performance drop versus vanilla PostgreSQL depending on workload.checked 11 Oct 2026
- PostgreSQL protocol
- Applications communicate with SPQR using the PostgreSQL protocol, and the router and coordinator have an administrative console accessible through psql.checked 11 Oct 2026
- Product
- SPQR is a production-ready system for horizontally scaling PostgreSQL through sharding.checked 5 Oct 2026
- Routing controls
- Queries can specify a sharding key or explicitly select a shard in a SQL comment.checked 5 Oct 2026
- Scale
- The product site says SPQR has handled terabytes of data and 100K+ queries per second.checked 5 Oct 2026
- Security
- The docs show PostgreSQL connections configured with SSL modes including require and verify-full.checked 11 Oct 2026
- Sharding keys
- The router supports single-column and composite sharding keys and routes queries using the key value.checked 11 Oct 2026
- Support
- The project directs users to its Telegram chat for discussion and GitHub Issues for bug reports or feature requests.checked 11 Oct 2026
- Use cases
- The maker recommends SPQR for developers who want to keep PostgreSQL and avoid implementing sharding logic in the application, especially for databases suited to single-shard OLTP queries.checked 11 Oct 2026
- What it does
- SPQR is a stateless PostgreSQL query router for horizontally scaling PostgreSQL through sharding.checked 11 Oct 2026
The company
- Maker
- The documentation says SPQR was designed by the Data Platform team of Yandex.Cloud.checked 5 Oct 2026
Alternatives to SPQR
- 1
OceanBase Database
Free planOpen sourceWebAPILinuxmacOS8.2$2.38 usage-based - 2

MySQL
Free planAPILinuxmacOSSelf-hosted7.9Free plan - 3
Supavisor
Free planOpen sourceAPILinuxSelf-hosted7.6From $25 a month - 4
Avidemux
Free planOpen sourceWebLinuxmacOSWindows7.3Free plan - 5
TiCDC
Free planOpen sourceAPILinuxmacOSSelf-hosted7.2Free plan - 6

Amazon RDS
Free planWebAPISelf-hosted7.1Free plan
