我是一个新的Influxdb用户,我的InfluxDB版本是1.7.1。在涌入时我有时间问题。
我有一个名为lv_table的测量,Listing_id和event_type是标签,event_id是字段
…
Influxdb自1970年1月1日起在内部将时间戳存储为纳秒,因此您的第一个数据点实际上被解释为: 1542711774019000 ns -> 1542711 s -> Sun Jan 18 20:31:51 UTC 1970 这就是你在cli中使用“precision RFC3339”时所看到的。
1542711774019000 ns -> 1542711 s -> Sun Jan 18 20:31:51 UTC 1970
不确定你是怎么做到的
1468800000000000 = 2016年7月18日星期一12:00:00 AM
1468800000000000 ns -> 1468800 s -> Sun Jan 18 00:00:00 UTC 1970 这是您的第一个数据点时间戳舍入为1天。
1468800000000000 ns -> 1468800 s -> Sun Jan 18 00:00:00 UTC 1970
您没有描述如何将数据放入表中。在Influx HTTP API中,您可以使用可选的查询参数指定输入时间戳数据的精度(请参阅 InfluxDB HTTP API参考 )。
Precision 涌入中的设置说明了如何处理输入时间戳数据。输入的时间戳值始终为整数(不是rfc3339字符串)。并且根据精度设置解释此整数。
Precision
precision=[ns,u,ms,s,m,h] Optional Sets the precision for the supplied Unix time values. InfluxDB assumes that timestamps are in nanoseconds if you do not specify precision ( 看Influx文档 这里)
precision=[ns,u,ms,s,m,h] Optional Sets the precision for the supplied Unix time values. InfluxDB assumes that timestamps are in nanoseconds if you do not specify precision
它还会影响查询结果的输出格式。见下面的例子:
```
> precision ns > insert demo value="precisionNS TS treated as nanoseconds" 1543220939000000000 > precision s > insert demo value="precisionS TS treated as seconds" 1543220940 > precision ms > insert demo value="precisionMS TS treated as ms" 1543220940123 > precision rfc3339 > select * from demo name: demo time value ---- ----- 2018-11-26T08:28:59Z precisionNS TS treated as nanoseconds 2018-11-26T08:28:59.123456789Z precisionNS TS treated as nanoseconds 2018-11-26T08:29:00Z precisionS TS treated as seconds 2018-11-26T08:29:00.123Z precisionMS TS treated as ms > > precision s > select * from demo name: demo time value ---- ----- 1543220939 precisionNS TS treated as nanoseconds 1543220939 precisionNS TS treated as nanoseconds 1543220940 precisionS TS treated as seconds 1543220940 precisionMS TS treated as ms > > precision ns > select * from demo name: demo time value ---- ----- 1543220939000000000 precisionNS TS treated as nanoseconds 1543220939123456789 precisionNS TS treated as nanoseconds 1543220940000000000 precisionS TS treated as seconds 1543220940123000000 precisionMS TS treated as ms