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

List-Based Partitioning

Explicitly assigning specific partition key values to nodes, useful for categorical data or geographic distribution.

List-Based Partitioning

What you'll learn: How to distribute data by explicitly mapping specific partition key values to designated nodes or partitions.

What Is List-Based Partitioning?

List-based partitioning assigns explicit lists of values to specific partitions. Unlike hash-based partitioning (which uses a function to scatter data) or range-based partitioning (which uses continuous value ranges), list-based partitioning lets you manually declare which values belong where.

Think of it like assigning students to dorm buildings by major: "Computer Science and Math students go to Building A, Business and Economics to Building B, Arts and Humanities to Building C." You're creating explicit membership lists for each partition.

When to Use List-Based Partitioning

This strategy shines when your data has natural categorical groupings:

  • Geographic distribution: Route EU customers to EU servers, US customers to US servers, APAC to APAC
  • Business units: Separate data by department, brand, or subsidiary
  • Regulatory compliance: Keep data for certain user types (minors, EU citizens) in specific jurisdictions
  • Service tiers: Premium customers on high-performance nodes, free tier on standard infrastructure

How It Works

You define a partition key (e.g., country_code) and create explicit mappings:

  • Partition 1: ['US', 'CA', 'MX']
  • Partition 2: ['GB', 'FR', 'DE', 'IT']
  • Partition 3: ['JP', 'CN', 'IN', 'AU']

When a request arrives with country_code = 'FR', the system routes it directly to Partition 2.

Key Characteristics

Advantages: Predictable data locality, regulatory compliance, optimized network latency, business-aligned partitioning

Challenges: Uneven distribution if categories have different sizes, requires maintenance as new values emerge, less automatic than hash-based approaches

Key Takeaway: List-based partitioning gives you precise control over data placement by explicitly mapping partition key values to nodes—ideal for categorical data, geographic distribution, and compliance requirements where data locality matters more than perfect balance.