FREEDOM251

Freedom251 › Database Proxy Software

SPQR

Free plan APILinuxSelf-hosted

Visit SPQR Alternatives Pricing

SPQR's own site

What SPQR is

SPQR is a self-hosted, open-source query router for horizontally scaling PostgreSQL through sharding. It can identify a sharding key in a query and route it to a matching key range and shard when possible. Keys may use one column or several, and SQL comments can specify a key or select a shard directly. Applications connect using the PostgreSQL protocol, while administrative consoles for the router and coordinator are accessible through psql. SPQR offers one-phase and two-phase commit strategies; two-phase commit provides atomicity across shards and requires max_prepared_transactions to be greater than zero on every shard. It can move data between shards to balance workload, using smaller transferred ranges to limit locking impact. The project describes handling terabytes of data and 100K+ queries per second. It works with managed PostgreSQL services including AWS RDS, Google Cloud SQL, and Azure Database, and names pgx and JDBC as compatible drivers. SPQR is free 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.

Who it suits

SPQR suits PostgreSQL developers who want to keep sharding logic out of their applications, especially for workloads centered on single-shard OLTP queries. It is not intended for OLAP or complex cross-shard work.

What it does well

  • Supports single-column and composite sharding keys.
  • Provides one-phase and two-phase commit strategies.
  • Can use several managed PostgreSQL services.
  • Free and distributed under the PostgreSQL license.

What to know first

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

Limits

SPQR is free and has no listed free-plan quota. Its stated workload limitations are complex cross-shard queries, transactions modifying multiple shards, and OLAP; two-phase commit also requires max_prepared_transactions greater than zero on every shard.

Plans

PlanBilled and limitsPrice
SPQROpen-source PostgreSQL sharding softwareFree

As docs.pg-sharding.tech lists them, read 11 Oct 2026. The maker's own page has the final word.

Getting started

  1. Open the SPQR documentation website.
  2. Use the Docker image or follow the configuration-file deployment instructions.
  3. Configure the router to connect to PostgreSQL shards, including supported managed PostgreSQL services if needed.
  4. Connect an application using the PostgreSQL protocol and a compatible driver such as pgx or JDBC.

Verdict

SPQR offers PostgreSQL sharding with query routing and data balancing, while keeping deployment self-hosted. Its stated workload limits and reported performance drop are important considerations before adoption.

Questions

How much does SPQR cost?

The listed SPQR plan costs nothing. It is open-source software.

Can I use SPQR with managed PostgreSQL?

Yes. Named services include AWS RDS, Google Cloud SQL, Azure Database, and Yandex Managed PostgreSQL.

What drivers are compatible?

The FAQ names pgx and JDBC as compatible driver examples.

Does SPQR support distributed transactions?

It offers one-phase and two-phase commit strategies. Two-phase commit provides atomicity across shards and requires max_prepared_transactions above zero on every shard.

Who designed SPQR?

The documentation says it was designed by the Data Platform team of Yandex.Cloud.

What license does SPQR use?

It is distributed under the PostgreSQL Global Development Group License.

Facts from SPQR's own pages

Automatic routing
The router extracts a sharding key from a query and uses it to select the key range and shard when possible. · docs.pg-sharding.tech, 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. · docs.pg-sharding.tech, 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. · docs.pg-sharding.tech, 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. · docs.pg-sharding.tech, 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. · docs.pg-sharding.tech, 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. · docs.pg-sharding.tech, 5 Oct 2026
License
The source is distributed under the PostgreSQL Global Development Group License. · github.com, 11 Oct 2026
Limits
The FAQ says SPQR is not suitable for complex cross-shard queries, transactions that modify multiple shards, or OLAP workloads. · docs.pg-sharding.tech, 11 Oct 2026
Maker
The documentation says SPQR was designed by the Data Platform team of Yandex.Cloud. · docs.pg-sharding.tech, 5 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. · pg-sharding.tech, 5 Oct 2026
Performance
The FAQ reports a roughly 10–30% performance drop versus vanilla PostgreSQL depending on workload. · docs.pg-sharding.tech, 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. · docs.pg-sharding.tech, 11 Oct 2026
Product
SPQR is a production-ready system for horizontally scaling PostgreSQL through sharding. · docs.pg-sharding.tech, 5 Oct 2026
Routing controls
Queries can specify a sharding key or explicitly select a shard in a SQL comment. · docs.pg-sharding.tech, 5 Oct 2026
Scale
The product site says SPQR has handled terabytes of data and 100K+ queries per second. · pg-sharding.tech, 5 Oct 2026
Security
The docs show PostgreSQL connections configured with SSL modes including require and verify-full. · docs.pg-sharding.tech, 11 Oct 2026
Sharding keys
The router supports single-column and composite sharding keys and routes queries using the key value. · docs.pg-sharding.tech, 11 Oct 2026
Support
The project directs users to its Telegram chat for discussion and GitHub Issues for bug reports or feature requests. · github.com, 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. · docs.pg-sharding.tech, 11 Oct 2026
What it does
SPQR is a stateless PostgreSQL query router for horizontally scaling PostgreSQL through sharding. · docs.pg-sharding.tech, 11 Oct 2026

Where SPQR stands on Freedom251

Look at these too