6 ms·
This is a good article! In ClickHouse, interval arithmetic is applied to index analysis. A sparse index consists of granules, and each granule is an interval o
by zX41ZdbW 2y ago
This is a good article!
In ClickHouse, interval arithmetic is applied to index analysis. A sparse index consists of granules, and each granule is an interval of tuples in lexicographic order. This interval is decomposed into a union of hyperrectangles. Conditions such as comparisons, logic operators, and many other functions are evaluated on these hyperrectangles, yielding boolean intervals. Boolean intervals represent ternary logic (always true, always false, can be true or false). Interesting tricks include: applying functions that are monotonic on ranges (for example, the function "day of month" is monotonic as long as the month does not change), calculating function preimages on intervals, and even calculating preimages of n-ary functions, which is useful for space-filling curves, such as Morton or Hilbert curves.
Check for more details: https://github.com/ClickHouse/ClickHouse/blob/master/src/Storages/MergeTree/KeyCondition.h https://github.com/ClickHouse/ClickHouse/blob/master/src/Sto...
Or see examples, such as https://adsb.exposed/ https://adsb.exposed/
- tucnak 2y agoClockhouse is real smart, I wish it spoke real SQL, and not some parody of SQL like it currently does.
- FridgeSeal 2y agoWhat’s wrong with its dialect? I use it heaps and haven’t any issues?
- zX41ZdbW 2y agoI have a presentation on this topic. https://presentations.clickhouse.com/meetup107/app/ https://presentations.clickhouse.com/meetup107/app/ Starting from slide 19, "How is it possible," explains why we need such a parody.