NEW RasterizedDB 1.1.0 is out: sharding and the gateway, the message broker, roles and row-level security, compression, .NET on NuGet, and the enterprise edition. What's new ›
SHARDING · QUERIES NEW IN 1.1.0

One query, many shards, one answer.

A statement with a route key goes to one shard. One without it fans out, and the gateway merges what comes back: counts, sums, GROUP BY, top-N and DISTINCT. Joins run locally when the schema is co-located, and are gathered when it is not.

Sharding and the gateway shipped in 1.1.0: every release server can run as a shard, and the gateway has release archives of its own. Not built yet: backup and restore of a whole cluster at one point, commit timestamps from a hybrid logical clock, and splitting a shard by cloning it.

1 / 3

Routed, fanned out, gathered

  • Point reads and writes by key: one shard, no coordination
  • Fan-out COUNT, SUM, GROUP BY, ORDER BY … LIMIT and DISTINCT, merged at the gateway
  • Co-located joins: tables sharded by the same key join on the shard
  • Reference tables: small tables copied to every shard so joins stay local
  • Gather joins for the rest, bounded by a size limit that fails rather than truncates
  • Consistent fan-out reads through a commit barrier
  • Deadlock detection across shards
2 / 3

Writes across shards

A transaction that writes to several shards commits with two-phase commit. COPY splits its rows by key and loads every shard in parallel; COPY into a reference table loads all of them.

9-10k tpsco-located join, 0.8 ms (dev build, one box)
12 s → 1 msa cross-shard join once its tables were co-located
2PCfor multi-shard writes
3 / 3

A rule of thumb

Shard the big tables by the key most queries carry, copy the small ones everywhere, and the cluster behaves like one database for almost every statement your application sends.

✓ page rendered in 190 µs axum + tera + htmx · no other javascript