Interview Q&A / System Design

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What is the difference between sharding and partitioning?

SHORT ANSWER

Partitioning splits a big table into smaller parts, often inside one database. Sharding is partitioning where the parts live on different servers, so both data and load are spread across machines.

Explain it simply

Think of a huge register of student records. Partitioning means tearing it into volumes (A to H, I to P, Q to Z) and keeping them in the same cupboard. Sharding means giving each volume to a different office in a different building.

Partitioning: one database server, but a table is split by rule (by date, by region) so queries touch less data and old partitions can be dropped easily. It helps performance and maintenance, not capacity beyond one machine.

Sharding: horizontal partitioning across multiple servers. Each shard holds a subset of rows and handles only its subset of traffic, so you can grow beyond the limits of one machine.

Sharding adds complexity: queries must be routed to the right shard, joins across shards are expensive, transactions across shards are hard, and rebalancing data when adding shards needs a plan.

Many people use "partitioning" and "sharding" loosely, so say which sense you mean.

Example

Orders table, 400 million rows.

text
Partitioning (one server): orders_2025_q1, orders_2025_q2 ...
   query for Q2 reads only that partition.
Sharding (many servers): customer_id % 4
   shard0: ids ending 0 mod 4 -> server A
   shard1: ids ending 1 mod 4 -> server B  ... and so on

What to say in the interview

"Partitioning divides data into smaller pieces, usually within one database; sharding places those pieces on separate servers to scale storage and throughput. I would exhaust indexing, caching, replicas and vertical scaling first, since sharding makes joins, transactions and rebalancing harder."

#sharding#databases

Related questions

Practise more System Design questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open System Design quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.