问题描述
我只是想知道ClickHouse是否可以用于存储时间序列数据,例如:模式的列: some_entity_id, timestamp, metric1, metric2, metric3,... , metricN。可以将包含度量标准名称的每个新列动态添加到表中,同时添加具有该度量标准名称的条目。
I just wonder if ClickHouse can be used for storing time-series data in the case like this: schema with columns: "some_entity_id", "timestamp", "metric1", "metric2", "metric3", ..., "metricN". Where each new column containing metric name can be added to the table dynamically, while adding entry with this metric name.
在官方文档中未找到有关动态表的任何信息
Have not found any information about dynamical table extend in official documentation.
那么这种情况可以在Clickhouse中实现吗?
So can this case be implemented in Clickhouse?
UPD:
经过一些基准测试后,我们发现ClickHouse写入新数据的速度比当前时间序列存储快,但是读取数据的速度要慢得多。
UPD:After some benchmarks we found out that ClickHouse writes new data faster than our current time-series storage, but reads data much more slower.
推荐答案
最好将架构修改为具有4列:
It would probably be better to modify your schema to have 4 columns:
some_entity_id, timestamp, metric_name, metric_value
"some_entity_id", "timestamp", "metric_name", "metric_value"
您可以在MergeTree索引中包括 metric_name,以提高搜索实体的特定度量时的性能。使用和不使用它进行测试,以查看它对您进行的查询是否有用。
You can include "metric_name" in the MergeTree index, to improve performance when searching for a specific metric of an entity. Test with and without it, to see if it's useful for the kind of queries you make.
这篇关于Clickhouse作为时间序列存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!