range-partitioning-boundary-routing-bisect

Status: IN

Key routing uses `bisect_right(boundaries, key) - 1` on a parallel sorted list of partition start keys, giving O(log p) partition lookup where p is the partition count.

Source: entries/2026/05/29/range-partitioning-range_partitioning.md

Example

def get_partition(self, key):
    idx = bisect.bisect_right(self._boundaries, key) - 1
    return self._partitions[max(0, idx)]

JSON