# DROP MEASUREMENT for InfluxDB 2.x?

**URL:** <https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399>\
**Category:** InfluxDB 2\
**Tags:** schema\
**Created:** [September 27, 2019, 1:54pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399 "2019-09-27T13:54:51Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![dswarbrick](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@dswarbrick](https://community.influxdata.com/u/dswarbrick)\
**Post date:** [September 27, 2019, 1:54pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/1 "2019-09-27T13:54:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [October 1, 2019, 6:31pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/2 "2019-10-01T18:31:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dswarbrick](https://avatars.discourse-cdn.com/v4/letter/d/3be4f8/32.png) [@dswarbrick](https://community.influxdata.com/u/dswarbrick)\
**Post date:** [October 2, 2019, 8:23am UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/3 "2019-10-02T08:23:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [October 3, 2019, 6:29pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/4 "2019-10-03T18:29:00Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![gdillen](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/gdillen/32/4207_2.png) [@gdillen](https://community.influxdata.com/u/gdillen)\
**Post date:** [April 4, 2020, 6:44pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/5 "2020-04-04T18:44:43Z")

</div>

Hi @Anaisdg is delete already implemented? See my question from yesterday: [Delete time series data from InfluxDB 2.0 (Cloud) - problem](https://community.influxdata.com/t/delete-time-series-data-from-influxdb-2-0-cloud-problem/13716)

Thanks.

---

<div class="post-metadata">

**Author:** ![olsonnn](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/olsonnn/32/6289_2.png) [@olsonnn](https://community.influxdata.com/u/olsonnn)\
**Post date:** [December 28, 2020, 3:58pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/6 "2020-12-28T15:58:27Z")

</div>

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”])

---

<div class="post-metadata">

**Author:** ![mephisto](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mephisto](https://community.influxdata.com/u/mephisto)\
**Post date:** [February 17, 2021, 10:14am UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/7 "2021-02-17T10:14:12Z")

</div>

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:

> <https://github.com/influxdata/influxdb/issues/20704>
>
> \<!--
> 
> Thank you for reporting a bug in InfluxDB. 
> 
> \* Please ask usage questi…ons on the Influx Community site.
> \* https://community.influxdata.com/
> \* Please add a :+1: or comment on a similar existing bug report instead of opening a new one.
> \* https://github.com/influxdata/influxdb/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+is%3Aclosed+sort%3Aupdated-desc+label%3Akind%2Fbug+
> \* Please check whether the bug can be reproduced with the latest release.
> \* The fastest way to fix a bug is to open a Pull Request.
> \* https://github.com/influxdata/influxdb/pulls
> 
> \--\>
> 
> \_\_Steps to reproduce:\_\_
> List the minimal actions needed to reproduce the behavior.
> 
> 1. Have data with tags in a measurement.
> 2. Delete Data with a specific tag value:
> 
> \`\`\`
> influx delete --bucket "telegraf/autogen" --predicate '\_measurement="devax\_forecast" AND fcdate="fc\_21012021"' -o NETZConsult --start '1970-01-01T00:00:00Z' --stop '2025-12-31T23:59:00Z')
> \`\`\`
> 
> 3. Check of Tag value is removed from the DB:
> 
> \`\`\`
> show tag values from devax\_forecast WITH key="fcdate"
> \`\`\`
> 
> and it's still showing up:
> 
> \`\`\`
> key |value
> fcdate |fc\_01022021
> fcdate |fc\_02022021
> fcdate |fc\_03022021
> fcdate |fc\_04022021
> fcdate |fc\_21012021
> fcdate |fc\_22012021
> fcdate |fc\_23012021
> fcdate |fc\_24012021
> fcdate |fc\_25012021
> fcdate |fc\_26012021
> fcdate |fc\_27012021
> fcdate |fc\_27012021\_erst
> fcdate |fc\_28012021
> fcdate |fc\_29012021
> fcdate |fc\_30012021
> \`\`\`
> 
> \_\_Expected behavior:\_\_
> The tag should disappear.
> 
> \_\_Actual behavior:\_\_
> The tag is still present, even if no records are assigned that tag.
> 
> \_\_Environment info:\_\_
> 
> \* System info: Linux 4.4.0-198-generic x86\_64
> \* InfluxDB version: InfluxDB 2.0.3 (git: fe04d346df) build\_date: 2020-12-15T01:00:16Z
> \* Other relevant environment details: Runs from debian Packages on a Ubuntu 16.04.7

This is a bit of a showstopper for me.

---

<div class="post-metadata">

**Author:** ![singhswat](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/singhswat/32/6551_2.png) [@singhswat](https://community.influxdata.com/u/singhswat)\
**Post date:** [February 20, 2021, 10:22am UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/8 "2021-02-20T10:22:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yonglizhong](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/yonglizhong/32/7781_2.png) [@yonglizhong](https://community.influxdata.com/u/yonglizhong)\
**Post date:** [July 6, 2021, 11:04am UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/9 "2021-07-06T11:04:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![midzelis](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/midzelis/32/7898_2.png) [@midzelis](https://community.influxdata.com/u/midzelis)\
**Post date:** [July 26, 2021, 11:59pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/10 "2021-07-26T23:59:03Z")

</div>

I was able to delete tags using a similar command…

```auto
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…

---

<div class="post-metadata">

**Author:** ![J0236385](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@J0236385](https://community.influxdata.com/u/J0236385)\
**Post date:** [August 11, 2021, 5:08pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/11 "2021-08-11T17:08:52Z")

</div>

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==”

---

<div class="post-metadata">

**Author:** ![se-l](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@se-l](https://community.influxdata.com/u/se-l)\
**Post date:** [March 22, 2022, 9:28pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/12 "2022-03-22T21:28:39Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)\
**Post date:** [December 10, 2022, 7:24pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/13 "2022-12-10T19:24:59Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![Timothee\_Bermond](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/timothee_bermond/32/13312_2.png) [@Timothee\_Bermond](https://community.influxdata.com/u/Timothee_Bermond)\
**Post date:** [May 25, 2023, 2:54pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/14 "2023-05-25T14:54:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bkkrng](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@bkkrng](https://community.influxdata.com/u/bkkrng)\
**Post date:** [July 18, 2023, 6:55pm UTC](https://community.influxdata.com/t/drop-measurement-for-influxdb-2-x/11399/15 "2023-07-18T18:55:44Z")

</div>

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…

```auto
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

```
