我有这样的表/系列
Message MessageValue
--------------- ---------------------
property1 10
property2 9
property3 7
property2 22
我想每10分钟对property2的平均值进行下采样。我该怎么办呢?
创建连续的查询" cq_10m" ON" DatabaseName" BEGIN SELECT mean(SELECT MessageValue WHERE Message = property2)AS" mean_Property2" INTO" RetentionPolicyName"。" downsampled_orders" FROM" TableName" GROUP BY时间(10分钟)结束
答案 0 :(得分:0)
如下所示。您的CQ将每10分钟查询一次数据库,并计算该时间范围内“ MessageValue”的平均值。这将被下采样到:mean_Property2。
CREATE CONTINUOUS QUERY "cq_10m" ON "dbName"
RESAMPLE EVERY 10m FOR 2h
BEGIN SELECT mean("MessageValue") AS mean_Property2 INTO
mean_Property2 FROM "retentionPolicyName"."measurementName" WHERE "Message"='property2'
GROUP BY time(10m) END