influxdb删除某一列数据(某一个数据点的历史数据)操作
-
删除某一列 (重要:看完下面说明,一定要看实际例子)
一个表有3个field(数据点),想去掉field3
1、除了field3列的数据都转移到临时"表"tmp上 (time,id,department是三个必填的tag):
select tag1, tag2, field1, field2 into tmp from old_measurement group by * ;2、删除旧"表"中的数据:drop measurement old_measurement;
3、数据转移到旧"表":select tag1, tag2, field1, field2 into old_measurement from tmp group by * ;
4、删除临时"表":drop measurement tmp;
实际例子:(id字段特殊,所以写法不同)
SELECT "time", "id"::STRING, "aa", "bb" into "tmp" from "abc123" group by * ;
drop measurement "abc123";
SELECT "time", "id"::STRING, "aa", "bb" into "abc123" from "tmp" group by * ;
drop measurement tmp;
================================================================
如果删除某时间范围内的删除前14天的话,在第一步查询时限定查询范围
SELECT "time", "id"::STRING, "aa", "bb" into "tmp" from "abc123" WHERE time > now() - 14d group by * ;