Skip to content
SPECIFICTION
Get listed

Mycat2 vs SPQR

Mycat2

github.com

SPQR

docs.pg-sharding.tech

Side by side

FigureMycat2SPQR
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
LinuxYesYes
API—Yes
Self-hostedYesYes
Plans published11
Spec score · Database Proxy Software7.6 (#13)7.8 (#9)
LicenseThe repository identifies the project license as Apache License from 2023.8.The source is distributed under the PostgreSQL Global Development Group License.
ProductMycat2 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.
SupportThe 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

Mycat2

  • Mycat2Free

Mycat2 pricing →

SPQR

  • SPQRFree

SPQR pricing →

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.

Visit github.com

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.

Visit docs.pg-sharding.tech