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

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
…