Can you delete data from influxdb?
It appears that you can do this in influxdb 0.9. For instance, here's a query that just succeeded for me:
DROP SERIES FROM temperature WHERE machine='zagbar'
(Per generous comment by @MuratCorlu, I'm reposting my earlier comment as an answer...)
delete data from influxdb 2.0
Delete data from same host:
influx delete --bucket example-bucket \
--start 2020-03-01T00:00:00Z \
--stop 2020-11-14T00:00:00Z
You can also delete data via Curl
curl --request POST https://influxurl/api/v2/delete?org=example-org&bucket=example-bucket \
--header 'Authorization: Token YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"start": "2022-01-19T06:32:00Z",
"stop": "2022-01-19T06:33:00Z",
"predicate": "_measurement=\"example-measurement\" AND feature=\"temp2\" "
}'
Predicate method not working properly. (bug)
Delete points with unwanted field values from InfluxDB measurement
This is still (2015 - 2020) not possible in InfluxDB - see ticket 3210.
You could overwrite the point with some other values by inserting in the measurement a point with the same timestamp and tag set:
A point is uniquely identified by the measurement name, tag set, and timestamp. If you submit a new point with the same measurement, tag set, and timestamp as an existing point, the field set becomes the union of the old field set and the new field set, where any ties go to the new field set. This is the intended behavior.
Since you're not supposed to insert nulls, you'll probably want to repeat the values from the previous point(s).
You might think about inserting a point with the same timestamp, and setting a unique value for one of the tags, then running a delete against that tag:
DELETE FROM measurement WHERE some_existing_tag='deleteme'
This won't work though. When you insert that second deleteme
point, it has a different tag set due to the deleteme
tag, so InfluxDB will create a new point for it. Then the DELETE
command will delete it, but not the original point you wanted to delete.
deleting columns from influx DN using flux command line
Unfortunately, there is no way to delete a "column" (i.e. a tag or a field) from an Influx measurement so far. Here's the feature request for that but there is no ETA yet.
Three workarounds:
use SELECT INTO to copy the desirable data into a different measurement, excluding the undesirable "columns". e.g.:
SELECT desirableTag1, desirableTag2, desirableField1, desirableField2 INTO new_measurement FROM measurement
use CAST operations to "change the data type" from float to int. e.g.:
SELECT desirableTag1, desirableTag2, desirableField1, desirableField2, undesiredableTag3::integer, undesiredableField3::integer INTO new_measurement FROM measurement
"Update" the data with insert statement, which will overwrite the data with the same timestamp, same tags, same field keys. Keep all other things equal, except that the "columns" that you would like to update. To make the data in integer data type, remember to put a trailing i on the number. Example: 42i. e.g.:
insert measurement,desirableTag1=v1 desirableField1=fv1,desirableField2=fv2,undesirableField1=someValueA-i 1505799797664800000
insert measurement,desirableTag1=v21 desirableField1=fv21,desirableField2=fv22,undesirableField1=someValueB-i 1505799797664800000
In Influxdb, How to delete all measurements?
Theres no way to drop all of the measurements directly, but the query below will achieve the same result.
DROP SERIES FROM /.*/
How can I delete measurements within a time range for a given RP?
Specifying Database and retention policy is not supported via InfluxQL. I hope it will be in the future or in IFQL.
For now I would recommend to use a different measurement for the aggregated data.
Related Topics
Sql Server Pass Column Name as Where Clause Parameter
How to Select Multiple Values in One Field MySQL
Convert String to Date in Ms Access Query
How to Get Only Digits from String in MySQL
How to Import CSV Data into a Table Without Knowing the Columns of the Csv
Sql Query for Values Consisting of Only a Specific Character
Sql Select Last N Rows, Sort Them Reversed
Sql String: Counting Words Inside a String
Find All Parent Records Where All Child Records Have a Given Value (But Not Just Some Child Records)
How to Use Return Value of Insert...Returning in Another Insert
Error:More Than One Row Returned by a Subquery Used as an Expression
Alternative to Row_Number() to Get Row Position
How to Exclude Specific Row from Query in MySQL
How to Find the Row Count for All Your Tables in Postgres
Search Text in Fields in Every Table of a MySQL Database
Mysql Convert Date from Mm-Dd-Yyyy to Yyyy-Mm-Dd Format
Display Each Department's Number and Name and the Number of Employees Employed in Each Department
How to Enforce Case Sensitive Table and Column Names in MySQL