在涌入数据库的用户定义列中保存EPOCH时间值

时间:2016-09-02 00:26:05

标签: epoch influxdb

我正在使用InfluxDB,并希望在用户定义列中编写Epoch时间值,如下面v1字段所示。

cpu_load,host=server01,core=0 value=0.45,v1=1437171724
cpu_load,host=server01,core=0 value=0.45,v1=1437171725

现在,我如何查询此列,就像我可以查询基于常规时间的列

一样
select * from cpu_load where v1 > '2016-08-31 00:42:24.000'

这个查询不起作用,但是如果我用时间列切换v1就可以了。

select * from cpu_load where time > '2016-08-31 00:42:24.000'

想知道如何在InfluxDB中使用用户定义时间/列值?

1 个答案:

答案 0 :(得分:2)

InfluxDB仅支持string,integer,float和boolean的字段类型。

time列是一个特例。即使它被存储为整数,但只有time字段可以使用基于时间的约束进行过滤。

长期以来feature request允许将字段与time进行比较。

同时,原始整数Epoch时间值可用于在v1字段上设置约束。 E.g。

select * from "cpu_load" where "v1" > 1472604144000