Mycat2 vs SPQR
Mycat2
github.comSPQR
docs.pg-sharding.techSide by side
| Figure | Mycat2 | 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 (#13) | 7.8 (#9) |
| License | The repository identifies the project license as Apache License from 2023.8. | The source is distributed under the PostgreSQL Global Development Group License. |
| Product | Mycat2 is a distributed relational database middleware that supports distributed SQL queries and the MySQL communication protocol. | SPQR is a production-ready system for horizontally scaling PostgreSQL through sharding. |
| Support | The repository links English and Chinese documentation hosted on Yuque. | The project directs users to its Telegram chat for discussion and GitHub Issues for bug reports or feature requests. |
Plans
In their own words
Mycat2
Mycat2 is free, open-source distributed relational database middleware for Linux and self-hosted deployment. It supports distributed SQL queries and the MySQL communication protocol while connecting to multiple backend databases through the Java ecosystem. Its query engine handles MySQL syntax and value types, rule- and cost-based optimization, and an independent physical execution engine. Data fragmentation is described as improving query processing. Users can customize and load sharding, serial-number and load-balancing algorithms. A project DSL manipulates physical query plans, forwards SQL and caches result sets. The README currently supports Java 8 only. Release notes for v1.22-2022-6-25 list ClickHouse as a backend for SELECT and INSERT, without returning auto-increment values. They also describe SQL permission interception, RSA encryption for user.json, and recycling inactive backend connections after a default 180-second timeout. The repository identifies an Apache License from 2023.8.
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.