...

/

Different Partitioning Strategies in Databases

Different Partitioning Strategies in Databases

Learn about different partitioning strategies in the database.

We'll cover the following...

This section will discuss two strategies to partition the dataset in a distributed environment:

  • Partition by a key range

  • Partition by key hash

Partition by a key range

In this strategy, we divide a continuous range of keys into buckets. Then, we assign each bucket to a partition. A single host instance can hold multiple partitions. The range of keys assigned to a bucket may or may not be continuous. Within each partition, they store keys in sorted order, thus facilitating range scan queries.

In the example above:

  • We have 3 host instances namely Node 1, Node 2, and Node 3.

  • Node 1 has 2 partitions.

    • Partition 1 includes keys starting from A, B, C, D, E.

    • Partition 2 includes keys starting from F, G, H, I, J.

  • Node 2 has 2 partitions.

    • Partition 3 includes keys starting from K , L , M, N, O.

    • Partition 4 includes keys starting from P, Q, ...