Why do joins get harder after sharding?
A join across two tables works efficiently when both tables live on the same machine. Once data is split across shards, a join between rows that ended up on different shards requires fetching data from multiple machines and combining it in application code or a query-federation layer — there's no single SQL query that can do it as elegantly as an unsharded join could.
Answered in
Database Sharding: What It Actually Costs When You Split the DatabaseSharding scales a database past one machine's limits, but it changes joins, transactions, and query patterns. Here's what each strategy trades away.
Read the full analysisOther questions this article answers
More system design & architecture questions
- How much spare capacity should a gateway keep?
- Why are bounded queues important for availability?
- Should a load balancer always move requests away from an unhealthy server?
- Can a circuit breaker prevent every cascading failure?
- Why does pagination improve API performance beyond just 'smaller responses'?
- Why is asynchronous logging faster than writing logs synchronously?
- When does caching actually help API performance, and when doesn't it?
- Why does payload compression trade CPU time for network time, and when is that worth it?
Every answer on Crashtech is written by the editor of the article it comes from — never auto-summarised. Browse all answers or the System Design & Architecture beat.