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:Documentation Index
Fetch the complete documentation index at: https://docs.pg-sharding.tech/llms.txt
Use this file to discover all available pages before exploring further.
{DistributionId}.DEFAULT.
For example, if the distribution has column types [varchar, integer, uuid], the default key range lower bound is ["", -9223372036854775808, "00000000-0000-0000-0000-000000000000"].
How to Use It
Given a distribution with key rangekr1 starting “From 0”, you can add a default shard:
How It Works
The default shard is implemented as a special key range with ID{distribution_id}.DEFAULT that covers the minimum possible value for your column types:
| Column Type | Default Lower Bound |
|---|---|
integer | -9223372036854775808 (MinInt64) |
uinteger | 0 |
varchar | "" (empty string) |
varchar hash | 0 |
uuid | "00000000-0000-0000-0000-000000000000" |