NOTE
5.2 Partitioning: Request Processing
How shard keys determine targeted routing, why missing shard keys cause scatter/gather, and the difference between local and global secondary indexes.
This is a historical learning note and may contain outdated or incomplete understanding.
A routing layer maps client reads and writes to the node that owns the relevant partition.
1. Requests With a Shard Key
For create, read, update, or delete operations that contain the partition/shard key:
- derive the logical partition from the key;
- resolve the partition’s current owner;
- send or forward the request to that node;
- execute the operation locally on the target partition.
This is the efficient path because the system can identify the destination without contacting unrelated partitions.
2. Requests Without a Shard Key
A predicate that does not contain a routable key may require scatter/gather:
- send the query to many or all relevant partitions;
- execute locally;
- merge, sort, aggregate, or reconcile results at the coordinator.
This can make an otherwise cheap query scale with the number of partitions.
3. Secondary Indexes
3.1 Local / Document-Partitioned Index
Each partition indexes only its own records. Writes are local, but a query by that secondary field may need scatter/gather across partitions.
3.2 Global / Term-Partitioned Index
Index entries are partitioned independently from the base records. A secondary-key lookup can route to the index partition, but writes now update another distributed structure and must handle its consistency and failure semantics.
Partition-key design and secondary-index design must therefore be considered together.