DROP MEASUREMENT for InfluxDB 2.x?

I’ve searched high and low, and I cannot find anything in InfluxDB 2.x that is equivalent to InfluxDB 1.x DROP MEASUREMENT. I realise I can drop buckets, but that seems like a fairly coarse approach if you simply want to drop a measurement (e.g. which may have been mistakenly created).

Is this functionality deliberately omitted, or has it just not landed yet?

1 Like

Hello @dswarbrick,
I image it will be added again. You could also create an issue to help prioritize it.

EDIT:
No - However a “predicate delete” is being added to the API that will allow delete based on a tagset filter. … so different implementation but same functionality

Thanks for your reply. It’s good to know that this functionality is still planned to be included. It sounds like it will be more analogous to “DROP SERIES … WHERE …”, than “DROP MEASUREMENT”. Would that be a fair assumption?

We’ve always been told that deleting data from time series DBs is bad, and we should instead just wait for it to age out by retention policy. Will these recommendations still apply to InfluxDB 2.x? There are likely to still be some occasions where data was inserted erroneously, and waiting for it to age out is not an option, especially if the bucket retention policy is long.

Hello @dswarbrick,
Once delete is added to the API, it would be possible to run a delete from Flux by calling out to the API. http.Post

Hi @Anaisdg is delete already implemented? See my question from yesterday: Delete time series data from InfluxDB 2.0 (Cloud) - problem

Thanks.

any update on this?
i’ve found how to delete colums in a measurement but not the measurement itself.

from(bucket: “Azure_SQL”)
|> range(start: -1m)
|> drop(columns: [“cpu”, “_measurement”])

I made the following observations, which are a bit unsatisfying:

You can delete a complete measurement with:

influx delete --bucket "telegraf/autogen" --predicate '_measurement="yourmeasurement' -o yourorg --start '1970-01-01T00:00:00Z' --stop '2025-12-31T23:59:00Z'

But you can’t delete data with specific tags from within:

influx delete --bucket "telegraf/autogen" --predicate '_measurement="yourmeasurement" AND yourtag="tagtodelete"' -o yourorg --start '1970-01-01T00:00:00Z' --stop '2025-12-31T23:59:00Z'

The Datapoints get dropped in this case but the tags are still present, which is highly undesireable.

See this Issue for it:

This is a bit of a showstopper for me.

Hi @Anaisdg @gdillen did you manage to drop any measurement in cloud? If yes, please share code sample

Any Updates on this? I am struggling to find a proper way to drop my full measurements too.

I was able to delete tags using a similar command…

influx delete --bucket "ups" --predicate '_field="watts"' -o Primary --start "1970-01-01T00:00:00Z" --stop "2025-12-31T23:59:00Z"

where ‘watts’ is the name of the tag…

I can drop my measurement by the below command

influx delete --bucket “PMCDemoDB” --org “PMCB” --predicate ‘_measurement=“demoTest”’ --start “1970-01-01T00:00:00Z” --stop “2025-12-31T23:59:00Z” --token “ATpHnTDycLD54vKQN1NWgbmtEF9uYZG65ssxbWil8S_GM4GEDGrrVcMSW0MOfavNc8i-Qj7TtVFLbsIYnjct1g==”

Failed for me. Dropping measurements is documented as a way to reduce excessive index cardinality having ingested too many tags. Now

  1. delete(predicate=’’’_measurement=“order book”)
  2. Then I reingest the data with fewer tags
  3. In Data explore tags show up again and it takes 20min just to load ~700Mb of the entire measurement. A simple select. I have never seen such terrible performance. after 2 accidental tags, each ~50 entries.
    Querying Influx ONCE more just to dump the data out of if. Probably setting up q. For 4h tried DROP Measurement. Reading here. 2x doesn support it.
    Curl, Python Client, Postman → everywhere “undefined identifier DROP”
1 Like

This Works for me & it deletes all the contents of the measurement

influx delete --bucket “Put the Name of yours” --org “Put the Name of yours” --predicate ‘_measurement=“Put the Name of yours”’ --start “2022-11-06T14:30:00Z” --stop “Put the Stop Time” --token “Put your Token Here”

Hello,
Does anyone know how to delete data in a python program? The influx delete method works in cli but I can’t implement it in my program.

I have used this several times in my gcp cloud db. If you select a from and to date that removes all records, I removes the measurement as well (as in, nothing left)

disclaimer: use it wisely and test it before running as you can wipe out your data with a click of a button…

import requests

token = '<api token>'
org = '<org>'
bucket = '<bucket>'
header_token = 'Token ' + token
url_delete = "https://<url_endpoint>/api/v2/delete?"

headers = {
    'Authorization': header_token,
    'Content-Type': 'application/json'
}

url_delete_api = url_delete+'org='+org+'&bucket='+bucket
data = '''{
    "start": "<from_date>",\
    "stop":  "<to_date>",\
    "predicate": "_measurement=<measurement>"\
}'''

res = requests.post(url_delete_api,headers=headers, data=data)
res.text