Skip to content
SPECIFICTION
Get listed

SPQR

docs.pg-sharding.tech

Free plan LinuxAPISelf-hosted

What it is

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.

Spec sheet

What it does
SPQR is a stateless PostgreSQL query router for horizontally scaling PostgreSQL through sharding.Read 11 Oct 2026 · docs.pg-sharding.tech
Product
SPQR is a production-ready system for horizontally scaling PostgreSQL through sharding.Read 5 Oct 2026 · docs.pg-sharding.tech
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.Read 5 Oct 2026 · docs.pg-sharding.tech
Deployment
The getting-started guide provides a Docker image and lists router, admin console, and gRPC API ports as 6432, 7432, and 7000.Read 11 Oct 2026 · docs.pg-sharding.tech
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.Read 11 Oct 2026 · docs.pg-sharding.tech
Security
The docs show PostgreSQL connections configured with SSL modes including require and verify-full.Read 11 Oct 2026 · docs.pg-sharding.tech
Support
The project directs users to its Telegram chat for discussion and GitHub Issues for bug reports or feature requests.Read 11 Oct 2026 · github.com
License
The source is distributed under the PostgreSQL Global Development Group License.Read 11 Oct 2026 · github.com
Maker
The documentation says SPQR was designed by the Data Platform team of Yandex.Cloud.Read 5 Oct 2026 · docs.pg-sharding.tech
Automatic routing
The router extracts a sharding key from a query and uses it to select the key range and shard when possible.Read 5 Oct 2026 · docs.pg-sharding.tech
Data balancing
SPQR migrates data between shards to balance workload and describes reducing the size of transferred ranges to minimize locking impact.Read 5 Oct 2026 · docs.pg-sharding.tech
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.Read 11 Oct 2026 · docs.pg-sharding.tech
Limits
The FAQ says SPQR is not suitable for complex cross-shard queries, transactions that modify multiple shards, or OLAP workloads.Read 11 Oct 2026 · docs.pg-sharding.tech
Managed PostgreSQL
The product site says SPQR can use managed PostgreSQL services including AWS RDS, Google Cloud SQL, and Azure Database for its shards.Read 5 Oct 2026 · pg-sharding.tech
Performance
The FAQ reports a roughly 10–30% performance drop versus vanilla PostgreSQL depending on workload.Read 11 Oct 2026 · docs.pg-sharding.tech
PostgreSQL protocol
Applications communicate with SPQR using the PostgreSQL protocol, and the router and coordinator have an administrative console accessible through psql.Read 11 Oct 2026 · docs.pg-sharding.tech
Routing controls
Queries can specify a sharding key or explicitly select a shard in a SQL comment.Read 5 Oct 2026 · docs.pg-sharding.tech
Scale
The product site says SPQR has handled terabytes of data and 100K+ queries per second.Read 5 Oct 2026 · pg-sharding.tech
Sharding keys
The router supports single-column and composite sharding keys and routes queries using the key value.Read 11 Oct 2026 · docs.pg-sharding.tech
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.Read 11 Oct 2026 · docs.pg-sharding.tech

Plans and prices

SPQR Free Open-source PostgreSQL sharding software Read 11 Oct 2026 · github.com

Every SPQR plan and price →

Strong points and limits

Strong points

  • Routes queries using single- or multi-column keys.
  • Supports one-phase and two-phase commit.
  • Can migrate data between shards.
  • Works with managed PostgreSQL services.
  • Free under the PostgreSQL Global Development Group License.

Limits

  • Not suitable for complex cross-shard queries.
  • Not suitable for transactions modifying multiple shards.
  • Not suitable for OLAP workloads.
  • FAQ reports a roughly 10–30% performance drop.

Who it suits

SPQR is intended for PostgreSQL developers who want to avoid implementing sharding logic in their applications, especially for workloads suited to single-shard OLTP queries. It may fit teams prepared to deploy and manage a self-hosted router.

Verdict

SPQR offers PostgreSQL sharding with query routing and distributed commit options. Its stated workload limits and reported performance drop are important considerations before choosing it.

Where Specifiction places it

Alternatives to SPQRAll alternatives →