Influxdb如何选择和删除不是整数值的数据

时间:2016-01-01 07:30:17

标签: select null nan influxdb

我在Grafana中有压力图,如下所示:Pressure graph

有一点与NaN'值。如何从InfluxDB中删除它? 我试过这个问题:

+-------------+---------------+-------------+
| id          | code          | code2       |
+-------------+---------------+-------------+
| 10255911    |sample data    |sample data  |
| 10255912    |sample data    |sample data  |
| 10255913    |sample data    |sample data  |
+-------------+---------------+-------------+

但它不起作用; /

我明白了:

> select * from pressure where value is not null;
> select * from pressure where value is null;
ERR: error parsing query: found NOT, expected SELECT, DELETE, SHOW, CREATE,       DROP, GRANT, REVOKE, ALTER, SET at line 1, char 39
> select * from pressure where value < 900;
> select * from pressure where value = 'NaN';
> select * from pressure where value = null;
> select * from pressure where value = -28;
> select * from pressure where value = "0";
> select * from pressure where value = '0';
> select * from pressure where value = 0;

然后:

> SELECT * FROM pressure WHERE time > '2016-01-01T01:00:00Z'   AND time < '2016-01-01T04:00:00Z'
 name: pressure
 --------------
 time           database    value
 [...]
 1451611512766000000    home        1003.4
 1451611572834000000    home        -28.4

1 个答案:

答案 0 :(得分:1)

这看起来像InfluxDB 0.9。删除特定点没有好办法。这是允许所需性能的core assumptions之一。 NaN也不是有效的数据类型,但不幸的是,有一些短暂的摄取路径没有清理NaN个条目。

您最好的方法是使用有限选择来确定点,例如SELECT * FROM pressure WHERE time > '2016-01-01T02:00:00Z' AND time < '2016-01-01T03:00:00Z' GROUP BY *NaN点应该在返回的某个地方。

找到该点后,记录完整的标签集和时间戳。标记集将位于查询返回的分组中。然后,您可以使用完全相同的时间戳和标记集提交新点,但NaN字段的值不同。这一新观点将无声地覆盖旧观点。