Skip to main content
A distribution can have a default shard that acts as a catch-all fallback. When the router matches a query to a distribution with a default shard, it is guaranteed to find a route — even if the sharding key doesn’t fall within any explicitly defined key range. The default shard is implemented as a special key range with the minimum possible value as its lower bound. This key range has a reserved ID: {DistributionId}.DEFAULT. For example, if the distribution has column types [varchar, integer], the default key range lower bound is ["", -9223372036854775808].
-- Setup: key ranges kr1: [-20, -10) → sh2, kr2: [-10, 0) → sh3, kr3: [0, ∞) → sh4
-- Default shard: sh1 (covers MinInt64 to -20)

INSERT INTO t(id) VALUES (-30);  -- → sh1 (default, below all explicit ranges)
INSERT INTO t(id) VALUES (-20);  -- → sh2 (kr1)
INSERT INTO t(id) VALUES (-10);  -- → sh3 (kr2)
INSERT INTO t(id) VALUES (0);    -- → sh4 (kr3)
See Default Shard for more details.