【发布时间】:2021-01-13 02:00:11
【问题描述】:
我正在使用 influxdb 1.7
我有一个名为“测试”的测量,如下所示
> SELECT * FROM test
name: test
time code host f_range value
---- --- ---- ------- -----
1610532240000000000 a localhost 0.101~0.200 7
1610532240000000000 a localhost 0.401~0.500 1
1610532240000000000 b localhost 0.101~0.200 3
1610532300000000000 b localhost 0.101~0.200 3
1610532300000000000 b localhost 0.201~0.300 1
1610533020000000000 a localhost 0.101~0.200 4
1610533020000000000 a localhost 0.201~0.300 1
1610533020000000000 a localhost 0.401~0.500 1
1610533020000000000 b localhost 0.101~0.200 6
1610533620000000000 a localhost 0.101~0.200 11
1610533620000000000 b localhost 0.101~0.200 8
我还可以将其按标签值分组,例如 ...
> SELECT sum("value") FROM "test" WHERE ("code" =~ /^a$/ AND "host" =~ /^localhost$/) AND time >= now() - 30m GROUP BY "f_range" fill(0)
name: test(0)
tags: f_range=0.101~0.200
time sum
---- ---
1610500909884441460 22
name: test
tags: f_range=0.201~0.300
time sum
---- ---
1610500909884441460 1
name: test
tags: f_range=0.401~0.500
time sum
---- ---
1610500909884441460 2
但是当我在查询中添加time(1m) 条件时,它什么也不返回。
我想知道在这种情况下我应该检查什么。
> SELECT sum("value") FROM "test" WHERE ("code" =~ /^a$/ AND "host" =~ /^localhost$/) AND time >= now() - 30m GROUP BY time(1m), "f_range" fill(0)
>
谢谢
【问题讨论】:
标签: group-by time-series influxdb