我们使用clickhouse存储网页加载的内部性能指标。每个度量都包含一个键/值对数组,用于它们关心的自定义加载时间。我们希望将这些存储在clickhouse中,并能够像查询任何其他时间值一样查询时间。
例如,当我得到一个度量值,以及所有标准数据时,我可能会得到一些数据,这些数据会给我一堆自定义内容的加载时间,比如:
TimeStamp=1548268715
CustomEvents="a=10,b=20,c=30"
在本例中,我要存储值 a=10
, b=20
,和 c=30
以这样的方式:
它仍然绑定到原始数据(因此我可以按时间戳、任何其他字段等进行过滤)。
我可以聚合和查询特定的“自定义事件”。例如,我可能想对所有事件做一个直方图 a
特定日期之间的时间值。
挑战在于我不知道存在哪些定制事件。我想我可以将这些列为白名单,但是它们的数量可能会变得非常大,而且定制事件的基数非常高。
如果你有任何想法,我将不胜感激。我有一些想法,但不介意任何想法。
1条答案
按热度按时间tvokkenx1#
clickhouse中的标准方法是使用嵌套结构,并从使用数组连接的结构中进行选择。
clickhouse中的underhood嵌套字段只是一组长度相同的数组。
样品:
创建这样的表
将数据作为多个数组引用嵌套的子字段。这些数组的名称应以嵌套名称作为前缀,长度应相同:
现在您可以使用array join从性能指标中选择: