Block decomposition: how ClickHouse, Prometheus, and InfluxDB rediscovered the same fundamental algo

https://hackernoon.imgix.net/images/razE16q4ySUQ3BYMQZHUHj9L0493-q783a0t.png

Block decomposition is the design that 3 separate teams, writing in different languages and handling slightly overlapping workloads, chose to use for their time-series database. All of ClickHouse, Prometheus, and InfluxDB partition their time series data into "sealed blocks", put a small summary in the "side" of each block, and handle a range query by unioning the summaries from all the blocks totally contained within the range with partial scans on the one or two blocks at the edge of the range. This is basically sqrt-decomposition, one of the most popular data structures for competitive programmers when trees can’t be used because of the nature of range-query requests. Let’s explain why the claim is true, where and why every design slightly breaks down the concept, and why this is something every engineer should understand.

What square-root decomposition actually is

In general, sqrt-decompositionis a method (or a data...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE