Limits
Everything the sharding gateway and a sharded cluster do not do in this version, in one place. Each item links to the page that explains it.
Release and packaging
- The server and gateway release archives are built with sharding, Raft and two-phase commit.
rdb-shardis not part of any release archive: install it with Cargo (Install and run).
Connections and protocols
- Clients speak PostgreSQL to the gateway. MySQL and SQL Server clients need a front-end node in between (Routing and queries).
- The function-call protocol and replication connections are refused with
0A000. - Logins use SCRAM-SHA-256 (or
trustfor tests). Other methods (password,md5) are not offered by the gateway. - Client TLS is optional: the gateway cannot require it. GSSAPI encryption is declined.
- The native front end runs with
auth = trustonly, as one configured role in one database, and every request is its own autocommit statement.rasterizeddb_clientdoes not route through it (The native protocol). - A query string with several statements separated by
;is routed as a whole, to one shard. Send statements one at a time.
Schema
- Schema statements (
CREATE,ALTER,DROP,TRUNCATE, indexes) are refused through the gateway. Apply them withrdb-shard ddl, orrdb-shard execto drop a table (Sharded tables). - A schema change is applied shard by shard, not atomically. Its tables are fenced (
40001) until every shard agrees. - After you mark or unmark a reference table that a gateway has already routed statements for, restart that gateway.
- Role and privilege statements go through the gateway but are applied shard by shard, not atomically, and only outside a transaction block.
Keys, uniqueness and sequences
- A statement that names no shard key value is refused unless fan-out is turned on (
unrouted = fan_out). - An
INSERTinto a sharded table must give the shard key's value. A key left to a default or a sequence is refused. PRIMARY KEYandUNIQUEare checked per shard: unique across the cluster only when they include the shard key.- Sequences and
SERIALcolumns are per shard: values repeat across shards. - All rows of one key value live on one shard. A key value cannot be spread over several shards.
Reads across shards
- A
LIMITwithoutORDER BYin a keyless read is applied by each shard, so the result can hold up to that many rows per shard. ORDER BYis merged across shards only when it sorts by columns (withASC,DESC,NULLS FIRST/LAST). A keyless read sorted by an expression is gathered onto the home shard instead, which copies every sharded table it names.- Window functions,
UNION,INTERSECTandEXCEPTover a sharded table are computed across shards only inside a subquery or CTE, which is gathered (Routing and queries). SELECT ... FOR UPDATEwithout a key is refused.- A gathered statement copies every sharded table it names, whole, onto the home shard, up to
gather_max_bytes(256 MiB), then fails with54000. Filters are not pushed down to the shards first. - A prepared statement that fans out or gathers must be alone in its batch.
- Without
SET rdb.consistent_fanout = on, each shard reads at its own snapshot, so a transaction that committed on several shards may show on some and not others.
Writes and transactions
- Without
two_phase = on, a transaction writes on one shard; a multi-rowINSERTwhose rows span shards is refused; a keyless write needsSET rdb.unrouted_writes = each_shardand is not atomic. - Two-phase commit needs shards built with
sharding_2pc. - All Binds in one extended-protocol batch must reach one shard.
- A statement whose shard connection is lost after sending fails with
08007, outcome unknown; it is not retried. - Two-phase transactions caught by a crash stay prepared, with their rows locked, until
rdb-shard resolveruns (High availability).
COPY
COPY ... FROM STDINinto a sharded table is split by row only in text or CSV format, and only undertwo_phase = on(atomic) or withSET rdb.split_bulk_writes = onin autocommit (not atomic). Binary format is refused.COPYinto a reference table needstwo_phase = on.COPY ... TO STDOUTfrom a sharded table is refused. Read it withSELECT.
LISTEN, NOTIFY and the Redis protocol
- Notifications reach a listening session while it is idle, read from the shards about every 100 ms.
- Through the Redis protocol, a command whose keys are on several shards gets
-CROSSSLOT.KEYS,SCAN,FLUSHALL,INFO,CONFIG, publish/subscribe andMULTIare refused. - Moving a range does not move its cache entries.
Moving data
- Moves are started by an operator, by a gateway's
REBALANCE CLUSTER, or byrdb-shard rebalance --every. - A move must carry every partitioned table; a tenant must first have partitions of its own on its shard (
ISOLATE KEY). - Writes to the moving rows pause while the source is fenced.
- No command removes a shard from the map.
- After a move between shards the source keeps its old copy of the moved rows, unread.
- No program rewrites map files on disk. Copy the newest map to every shard and gateway before restarting them (Moving data).
- Each shard backs up on its own, to its own prefix; there is no backup or restore of the whole cluster at one point, and a shard's backup cannot be restored across a later move.
Availability
- A shard that is down makes its keys, and every statement that needs all shards, unavailable until it is back.
- The home shard is needed for logins (once the cache expires), new statement shapes, plain tables, cross-shard aggregates, and two-phase commit decisions.
- Per-shard Raft replicas are a preview: the gateway connects only to the map's address and does not follow a new leader. The map's standby addresses are not used by the gateway (High availability).
Administration
- The metrics endpoint has no authentication; neither it nor the configuration API has TLS.
- Gateway settings are read at start. Changes, including those stored through the configuration API, apply after a restart.
- Per-user shards need the enterprise gateway (Per-user shards).