# pg-sharding/spqr

Stateless Postgres Query Router.

Repository: https://github.com/pg-sharding/spqr
Canonical: https://ross.abutalabs.com/products/spqr
Homepage: https://pg-sharding.tech
Language: Go
License: NOASSERTION
License Family: other
Topics: go, postgresql, sharding, pooler, proxy, postgres
Last push: 2026-08-26T19:08:20+00:00

## Health v2 (maintenance only)
Score: 92/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 77, longevity 100
- inputs: {"age_days": 1839, "days_push": 7, "days_rel": 75, "gap_med": 47, "n_releases_24m": 12}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1465, forks 96 (observed 2026-08-28T04:04:48.198301+00:00)

## What it is
SPQR (Stateless Postgres Query Router) is a production-ready proxy that horizontally scales PostgreSQL via sharding by routing queries to the correct shard at the PostgreSQL protocol level. It is written in Go, stores sharding rules in etcd, and is battle-tested at Yandex Cloud for OLTP workloads.

## Use cases
- shard a large postgres database horizontally
- route queries to postgres shards without app-level sharding logic
- migrate a monolithic postgres database to a sharded setup
- scale postgres beyond terabytes of data and 100k queries per second
- automate resharding of an already sharded postgres cluster
- use managed postgres services like AWS RDS as shards behind a router

## When to choose
- your data exceeds several TB or vertical scaling has hit its limits
- workload is mostly single-shard OLTP queries with a clear sharding key
- you want a permissively licensed (PostgreSQL license) alternative to Citus or Vitess
- you want to keep using vanilla PostgreSQL instead of another database engine

## When to avoid
- you need cross-shard JOINs or multi-shard transactions
- your workload is OLAP or analytical — use Greenplum or similar instead
- your dataset is small enough to fit comfortably on a single instance

## Facets
- artifact type: service
- maturity: active
- function: database, routing, proxy, middleware
- domain: databases, microservices, backend, self-hosted
- platform: go, self-hosted, cloud
- tags: postgresql, sharding, query-router, oltp, connection-pooling, horizontal-scaling, database-proxy, linux, docker

## Member repositories
- pg-sharding/spqr (main) score 92

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:48.198301+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:35:06.612538+00:00, confidence not recorded.
  - readme: https://github.com/pg-sharding/spqr (fetched 2026-08-28T04:04:48.198301+00:00, sha c2afbda7820e)
  - homepage: https://pg-sharding.tech (fetched 2026-08-29T11:43:31.659288+00:00, sha b352981ef142)
  - site_page: https://docs.pg-sharding.tech/welcome/faq (fetched 2026-08-29T11:43:31.668536+00:00, sha 31fa82ed5cad)
  - site_page: https://docs.pg-sharding.tech (fetched 2026-08-29T11:43:31.670686+00:00, sha e12a8043e9db)
  - site_page: https://docs.pg-sharding.tech/welcome/get_started (fetched 2026-08-29T11:43:31.673283+00:00, sha f58f15a9c371)
- Data as of 2026-08-30T08:39:29.467469+00:00.
