Cross-Shard Queries: The Hard Problem
Understand why cross-shard joins and transactions are the hardest problem in distributed databases, and the patterns that minimise them.
The Sharding Tax
Sharding scales writes and capacity but makes queries that span shards painful: every cross-shard query is a fan-out.
Single-Shard Queries Are Easy
If your shard key is in the WHERE clause, the router sends one query to one shard:
-- shard_id = hash(user_id) % N
SELECT * FROM orders WHERE user_id = 42;
-- Router computes shard, sends one query, gets one result.All lessons in this course
- Sharding Strategies: Range, Hash, Directory
- Cross-Shard Queries: The Hard Problem
- Citus and Distributed Postgres
- When NOT to Shard