Time-Series Sharding — Choosing the Partition Key

Time-Series Sharding — Choosing the Partition Key A workflow diagram generated by Archify. 01 / Decision 02 / Key Range 03 / Hash EX / Hotspot Guard Ask about the workload Pick the key, then guard it Shard a sensor month · 120k writes, 51 sensors · Decision › Ask about the workload · measure first Shard a sensor month 120k writes, 51 sensors measure first One-sensor month scans? · range over one sensor · Decision › Ask about the workload · decide One-sensor month scans? range over one sensor decide One sensor above 10%? · hot-sensor check · Decision › Pick the key, then guard it · decide One sensor above 10%? hot-sensor check decide Scatter reads OK? · fan-out budget · Decision › Pick the key, then guard it · decide Scatter reads OK? fan-out budget decide Hash(sensor_id) · one shard per sensor · Decision › Pick the key, then guard it · full scan per sensor Hash(sensor_id) one shard per sensor full scan per sensor sensor:timestamp ranges · one sensor, one shard · Key Range › Ask about the workload · 1-shard range scan sensor:timestamp ranges one sensor, one shard 1-shard range scan Hash(full key) · sensor:time:seq hashed · Hash › Pick the key, then guard it · fan-out 8, even writes Hash(full key) sensor:time:seq hashed fan-out 8, even writes Split the hot sensor · suffix 00..99 · Hotspot Guard › Pick the key, then guard it · reads merge 100 Split the hot sensor suffix 00..99 reads merge 100 no yes no yes no yes one month of sensors Legend Agent logic Policy Context / trace External system