Sharding Secondary Indexes — Local Versus Global

Sharding Secondary Indexes — Local Versus Global A data-flow diagram generated by Archify. 01 / Write 02 / Index Maintenance 03 / Query 04 / Results Write a Record · partition key known · 01 / Write · one shard touched Write a Record partition key known one shard touched Write a Record · terms span all shards · 01 / Write · many index writes Write a Record terms span all shards many index writes Local Index · per-shard postings · 02 / Index Maintenance · document-partitioned Local Index per-shard postings document-partitioned Global Index · sharded by term · 02 / Index Maintenance · term-partitioned Global Index sharded by term term-partitioned Scatter Query · ask every shard · 03 / Query · no partition key Scatter Query ask every shard no partition key Term Lookup · one shard per term · 03 / Query · postings from 1 shard Term Lookup one shard per term postings from 1 shard Merge Results · tail latency grows · 04 / Results · query throughput flat Merge Results tail latency grows query throughput flat Fetch by ID · set intersection · 04 / Results · records from N shards Fetch by ID set intersection records from N shards update only this shard write path query fans out to all scatter merge partial answers gather each term may live elsewhere write fan-out postings in a single shard targeted read IDs to owning shards record fetch Legend primary data data store data flow