1

In influxDB 1.x I could delete/drop any measurement in a simple way:

Influx
use mydatabase
DROP MEASUREMENT measurementname

In influxDB 2.x with Flux language, I have not found a straight way to delete/drop a measurement in an equivalent manner.

How do you delete (drop) a measurement in InfluxDb 2 ?

Any help is appreciated.

FeliceM
  • 4,163
  • 9
  • 48
  • 75

2 Answers2

2

There is no influx delete --measurement for deleting a measurement, but you can use influx delete --bucket and specify the argument of --predicate:

influx delete --bucket example-bucket \
  --start '1970-01-01T00:00:00Z' \
  --stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
  --predicate '_measurement="example-measurement"

reference to the doc: https://docs.influxdata.com/influxdb/v2.3/write-data/delete-data/

GaryFeng
  • 21
  • 3
  • My interpretation of this is that it would delete the data out of the measurement, but not the measurement itself. My understanding of influx 1.X is that if there are too many measurements (and series) that it could negatively impact the performance of queries, even if they contain no data. Is this still true in influx 2.X? – tom Aug 17 '23 at 20:35
0

You need to use double quotes:

DROP MEASUREMENT "measurementname"

For me it works as well

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77