NoSQL · Data models beyond tables

What partitioning strategies do NoSQL databases use?

Mediumpartitioningrange partitioninghash partitioningUpdated Oct 2026
Quiz this track

Short answer

Common strategies are range, hash, list and composite partitioning. The choice trades even load distribution against efficient range scans and predictable routing.

Partitioning splits a dataset into chunks that can be placed on different nodes. It is the mechanism underneath sharding. The strategy decides which rows land together, which directly controls query locality and hotspot risk.

Strategies

  • Range: contiguous key ranges, good for ordered scans but prone to hotspots on monotonic keys
  • Hash: a hash of the key, good for even distribution but poor for range queries
  • List: explicit groups such as region or tenant, good for isolation but can be unbalanced
  • Composite: a partition key plus clustering columns, common in wide-column stores for local ordering
sql
CREATE TABLE readings (
  sensor_id text,
  reading_at timestamp,
  value double,
  PRIMARY KEY ((sensor_id), reading_at)
);

SELECT value FROM readings
WHERE sensor_id = 'sensor-42'
  AND reading_at >= '2026-10-01'
  AND reading_at < '2026-10-02';
Hashing on sensor_id spreads sensors across nodes, while reading_at orders each sensor's readings within its partition.

The partition key should match how the application reads. If most queries fetch one tenant's data, partitioning by tenant keeps those reads local. If queries scan time ranges across all tenants, a time-only partition key may create a hot partition and little parallelism.

Partitioning and replication are different axes. A partition determines which data lives together; replication determines how many copies exist. A system needs both to be resilient and scalable.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What is the difference between partitioning and sharding?
  2. 2Why can range partitioning create hotspots?
  3. 3How do composite keys help in Cassandra?
  4. 4How would you repartition a growing dataset?

Say it in the interview

Partitioning decides which rows live together, and the common strategies are range, hash, list and composite. Hash spreads load evenly but limits range scans, while range supports ordered reads but can hotspot on monotonic keys. In wide-column stores I use a partition key plus clustering columns so one partition can serve an ordered range. I align the partition key with the dominant read pattern and check the largest partition before production.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live NoSQL mock interview and get scored feedback on depth, clarity and confidence.