Delete measurement in a bucket

I see this question has been posted in many different ways but I have not found any meeting my case.
I simply need to remove/delete completely a measurement in a bucket.
My bucket is “Donald”
The measurement to remove/delete is “Duck”
The measurement shall be completely removed from the bucket.
I have not found any tool to do the above in the UI.

In influx 1.x I simply use

Influx
use Donald
DROP MEASUREMENT Duck

How can I delete the measurement from the UI or using the CLI in Influx 2.3.x?

I would appreciate some help.

Thank you

influx delete --bucket example-bucket --start 2020-03-01T00:00:00Z --stop 2022-11-14T00:00:00Z --predicate ‘_measurement=“cpu”’

Thank you for your reply.
Could you kindly elaborate on why a start/stop date is required if the measurement is being completely deleted?
Does your suggested query remove completely the “cpu” measurement or only the data within the specified start/stop date range?

Thank you for helping

I did try but I am not coming right:

What I am trying to do is to completely delete the measurement shown in the picture “test”
Screenshot 2022-08-08 at 11.12.50

Hi Felice,

sorry for reply late.

As you can see, I have a measurement, test_data in testing/autogen bucket

from the command description, the start and stop should be optional, but when I tried to just type delete command without start and end, but it shows me an error
Error: Request flags “start, stop” not set

Therefore, I had to type start and stop flag
as you can see, there is no error when I add start and end flag
then, the test_data measurement can be deleted successfully

@Felice_Massaro Your influxd delete command didn’t work because you used curly quotes instead of straight quotes in the predicate and you didn’t close the outer single quote. You don’t need to include the start and stop flags. To fully remove a measurement, leave those out.

influx delete --bucket datastorage --predicate '_measurement="test"'
1 Like

@Scott Your suggestion does not seem to work.
The command returns an error saying the “start” and “stop” flags are required.
Here is the error I am getting: [Error: Required flags “start, stop” not set]
Here is the command I typed: [influx delete --bucket rts --predicate ‘__measurement=“stat”’]
My influx CLI version: [Influx CLI 2.6.1 (git: 61c5b4d533) build_date: 2022-12-29T12:58:32Z]

@yeboahnanaosei In the command that you provided, you have two underscores in front of measurement. You should only have one: _measurement.

@scott Thank you for that. I am actually surprised how the two underscores ended up there. I have taken a screen recording and I will share that soon. The command still requires you to specify the start and stop dates.

Here is a link to the screen recording: screen_recording.mp4 - Google Drive

Hi @scott, kindly, have you seen the video?

You can just include the start and stop times with the command:

influx delete \
  --bucket rts \
  --predicate '_measurement="stat"' \
  --start 1970-01-01T00:00:00Z \
  --stop 2023-02-16T00:00:00Z