Course contentsShow
← System Design
Lesson 1471 of 1,91936. Data Partitioning Strategies in DepthFree lesson

Range Partitioning Fundamentals

Understanding how range partitioning divides data using ordered key ranges for distribution.

Range Partitioning Fundamentals

You'll learn: How range partitioning distributes data across nodes by dividing an ordered key space into contiguous segments.

What Is Range Partitioning?

Range partitioning divides your dataset by assigning continuous ranges of keys to different partitions. Think of organizing a library: books A-F go on shelf 1, G-M on shelf 2, N-S on shelf 3, and T-Z on shelf 4. Each shelf (partition) owns a contiguous segment of the alphabetical order.

Unlike hash-based partitioning (which scrambles keys across partitions), range partitioning preserves order. If your partition key is a timestamp, user ID, or alphabetical identifier, records that are "close" in value live in the same partition.

How It Works

You define boundary values called split points. For example:

  • Partition 1: keys from 0 to 999
  • Partition 2: keys from 1000 to 4999
  • Partition 3: keys from 5000 to ∞

Each incoming record's key is compared against these ranges to determine its home partition. The system routes writes and queries to the appropriate partition based on simple comparison logic.

Key Advantages

Efficient range queries: Want all users born between 1990-1995? That data likely sits in one or two adjacent partitions, not scattered across dozens like with hash partitioning.

Natural ordering: Applications that need sorted iteration (leaderboards, time-series analysis, pagination) benefit enormously.

The Hotspot Challenge

The major risk is uneven data distribution. If everyone's username starts with 'A', partition 1 becomes overloaded while partition 26 sits idle. Unlike consistent hashing's uniform distribution, range partitioning requires careful split point selection based on actual data characteristics.

Key Takeaway: Range partitioning divides data using ordered key ranges, enabling efficient range queries and sorted access but requiring thoughtful boundary selection to avoid hotspots.