Altinity.Cloud
Managed service for ClickHouse in any AWS, GCP, and Azure region or your own VPC
Support for ClickHouse
Training for ClickHouse
Altinity Administrator Training
Pricing for managed ClickHouse
Calculator for managed service for ClickHouse
Customer stories
See why our customers love us
Altinity Plans and Features
Managed service or support? Compare plans and features
cpu — plain schema, every metric in a separate column
cpu_a — schema with metrics.name/value arrays
cpu_alc — similar to above, but metrics.name is LowCardinality(String)
cpu_r — schema with every metric in a separate row.
cpu_rlc — similar to above, but metric_name is LowCardinality(String)
Results are split into two graphs with different scale:
Light queries typically execute below 100ms per query
Heavy queries take several seconds per query
Conclusion
ClickHouse is very flexible and allows use of different designs for time series data. It is heavily optimized for well structured and properly typed schema, which is where the best query performance can be achieved. It allows, however, the use of semi-structured data as well, and the key-value array approach is a good design choice.
Using two distinct arrays — for metric names and metric values — shows just a small size overhead when LowCardinality(String) is used for names, and good performance. For simple lookups query performance degradation is hardly notable, but it is quite pronounced when heavy computational queries are used. Unlike plain columns, ClickHouse can not properly utilize its vectorized execution engine when processing arrays. Adding materialized columns, which can be added ‘on-the-fly’, can improve performance where necessary.
Schema layout is just a first but very important step of application design. Proper attention should be also paid to:
Data types — see this Percona benchmark that highlights the importance of dat?types: https://www.percona.com/blog/2019/02/15/clickhouse-performance-uint32-vs-uint64-vs-float32-vs-float64/
Materialized views for speeding up ‘last point’ or ‘asof’ queries — see https://altinity.com/blog/clickhouse-continues-to-crush-time-series
Scaling out if one server is not enough — see https://altinity.com/blog/clickhouse-timeseries-scalability-benchmarks
ClickHouse is evolving rapidly. Exotic ASOF joins and time series-specific column encodings are already there. Stay tuned to learn about them soon!