# Shard design doesn't start from your tables

DevFeed: [Shard design doesn't start from your tables](<https://devfeed.tech/articles/shard-design-doesn-t-start-from-your-tables-98539.md>)

Original publisher: [Read original article](<https://planetscale.com/blog/shard-groups-the-unit-of-co-location>)

Author: Rohit Nayak

Published: 2026-10-23T00:00:00Z

Content type: article

Language: en

Sources: [PlanetScale](<https://devfeed.tech/sources/blog-planetscale.md>)

Topics: [table-partitioning](<https://devfeed.tech/topics/table-partitioning.md>), [schema design](<https://devfeed.tech/topics/schema-design.md>), [Transactions](<https://devfeed.tech/topics/transactions.md>), [rdbms](<https://devfeed.tech/topics/rdbms.md>), [JOIN](<https://devfeed.tech/topics/join.md>)

Tags: [64-bit](<https://devfeed.tech/tags/64-bit.md>), [aggregate](<https://devfeed.tech/tags/aggregate.md>), [algorithm](<https://devfeed.tech/tags/algorithm.md>), [atomic](<https://devfeed.tech/tags/atomic.md>), [best](<https://devfeed.tech/tags/best.md>), [can](<https://devfeed.tech/tags/can.md>), [catalog](<https://devfeed.tech/tags/catalog.md>), [change](<https://devfeed.tech/tags/change.md>), [clusters](<https://devfeed.tech/tags/clusters.md>), [column](<https://devfeed.tech/tags/column.md>), [commit](<https://devfeed.tech/tags/commit.md>), [concepts](<https://devfeed.tech/tags/concepts.md>), [copy](<https://devfeed.tech/tags/copy.md>), [cross](<https://devfeed.tech/tags/cross.md>), [customer](<https://devfeed.tech/tags/customer.md>), [design](<https://devfeed.tech/tags/design.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [key](<https://devfeed.tech/tags/key.md>), [neki](<https://devfeed.tech/tags/neki.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [queries](<https://devfeed.tech/tags/queries.md>), [tables](<https://devfeed.tech/tags/tables.md>), [transactions](<https://devfeed.tech/tags/transactions.md>)

## AI overview

Design shard groups around keys shared by important queries and transactions: co-locate related tables so joins and transactions stay on one shard. In Neki, matching shard keys and hashing place rows with the same key together; reference tables are copied to each listed shard, keeping joins local. Cross-shard transactions lack atomic commit and a shared snapshot. The article describes `xxhash` as its recommended index, `range` for direct integer ranges, and `modulo` as predictable but costly to change at scale. A global secondary index can support lookups by a non-shard key through two single-shard reads. MoveTables imports data and can create initial reference-table copies; Reshard changes shard keys or shard counts as query needs evolve.

## Source excerpt

Shard group design starts from your queries, not your tables. Find the key that your most important queries and transactions share, and put every table that carries that key in one group.