Hash partition vs time partition
A hash partition spreads rows by key, so a query for one day reads every partition. A time partition keeps each day apart, so the query reads one partition. On 1 billion rows over two years, yesterday's totals take over 60 s with hash partitions. With time partitions, p99 is 4.1 ms.
Hash ring · 3 to 4 nodes · 8 of 36 keys move
Case 1
A page-view table holds 1 billion rows from two years. The dashboard asks for yesterday's totals twice each second. p99 must stay below 2 s and writes below 100 ms.
| Measure | Goal | Partition by hash of the key | Partition by day |
|---|---|---|---|
| p99 latency (Dash) | under 2 s | 60.4 s Fail | 4.1 ms Pass |
| p99 latency (Views) | under 100 ms | 10.1 s Fail | 3.4 ms Pass |
| Error rate (*) | under 0.1% | 92.5% Fail | 0% Pass |
| Monthly cost | 16 USD/mo | 16 USD/mo | |
| Error rate | 88.4% | 0% |