本文介绍了Clickhouse 作为时间序列存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道 ClickHouse 是否可用于在这样的情况下存储时间序列数据:带有列的架构:some_entity_id"、timestamp"、metric1"、metric2"、metric3",...,公制N".每个包含指标名称的新列都可以动态添加到表中,同时添加具有此指标名称的条目.

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?

统一更新:经过一些基准测试,我们发现 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 作为时间序列存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-17 07:17