DEV Community

Cover image for Compacting historical data in Clickhouse
Onelinerhub
Onelinerhub

Posted on

Compacting historical data in Clickhouse

In most cases you need full details on your data collected, so you don’t want to compact (store aggregated) your data. But there are plenty of cases, when you actually need only recent data in full perspective and historical data can be easily compacted.

E.g. you will only want to save, say, last month of collected user events in event-per-row form. But older data is fine to keep aggregated in total events per day format.

This can save space and reduce query execution times. Clickhouse can manage this automatically, let’s see how.

Latest comments (0)