Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] DROP MEASUREMENT should accept regex #4275

Open
beckettsean opened this Issue Sep 29, 2015 · 14 comments

Comments

Projects
None yet
@beckettsean
Copy link
Contributor

beckettsean commented Sep 29, 2015

e.g. DROP MEASUREMENT /^foo/ should drop all measurements starting with "foo".

@beckettsean

This comment has been minimized.

Copy link
Contributor Author

beckettsean commented Oct 7, 2015

related to #4351

@dgnorton not sure if it makes sense to tackle both at once, probably not. However, once we support SHOW with regex, it's natural to want DROP with regex.

@huhongbo

This comment has been minimized.

Copy link

huhongbo commented Dec 22, 2015

#4501 has support show measurement ,how about drop support?

@beckettsean

This comment has been minimized.

Copy link
Contributor Author

beckettsean commented Dec 22, 2015

@huhongbo that PR only addressed the SHOW MEASUREMENT command.

@vchekan

This comment has been minimized.

Copy link

vchekan commented Mar 10, 2016

It would be nice to have a "dry-run" modifier for DROP command.

@bentatham

This comment has been minimized.

Copy link

bentatham commented Jun 20, 2016

+1

@bentatham

This comment has been minimized.

Copy link

bentatham commented Jun 20, 2016

As a workaround (for others that might need this now), I did this (to delete all measurements starting with spinach:

influx --execute 'show measurements' --database=db | grep "^spinach" | xargs -I{} influx --database=db --execute 'drop measurement "{}"'

Not particularly efficient of course, but gets the job done.

@jwilder

This comment has been minimized.

Copy link
Contributor

jwilder commented Jan 24, 2017

This is currently supported via delete from /^foo/. A delete from without any filter criteria works the same as a drop measurement.

@Baiteman

This comment has been minimized.

Copy link

Baiteman commented Mar 20, 2017

I do not recommend the previous suggestion when a lot of data is affected. Turns out it is a quick way to max out your machine's ram (from 2 to ~ 13 GB in about half a minute xD)

@ninjarocketman

This comment has been minimized.

Copy link

ninjarocketman commented Mar 19, 2018

Also delete does not drop the series from the index. So deleting data with delete can lead to a polluted index. Regex support for drop measurement would be great to fully clean data.

@AvinKumar

This comment has been minimized.

Copy link

AvinKumar commented Jul 18, 2018

Any updates on this feature.? I am in badly need a fix. In my case lot of junk measurements got created and I'm struggling to delete them. I also tried the suggestion given by bentatham but that didn't work too.

influx --database='mydb' -host 'localhost' -port '8086' -username 'test' -password 'test' --execute 'show measurements' | grep "^java" | xargs -I{} influx --database='mydb' -host 'localhost' -port '8086' -username 'test' -password 'test' --execute 'drop measurement "{}"'

Influxdb version: 1.5.2

@TattiQ

This comment has been minimized.

Copy link

TattiQ commented Jul 19, 2018

@AvinKumar why didn't it work? what did you see exactly when running this command?

I used to run

influx --execute 'show measurements' --database=db | grep "^measurement_name-*" | head -20 | xargs -I{} influx --database=db --execute 'drop measurement "{}"'

I deleted the data in portions since full compaction kicked in and this is a resource intensive process as it turned out.

Full Compactions - Full compactions run when a shard has become cold for writes for long time, or when deletes have occurred on the shard. Full compactions produce an optimal set of TSM files and include all optimizations from Level and Index Optimization compactions. Once a shard is fully compacted, no other compactions will run on it unless new writes or deletes are stored.

@TattiQ

This comment has been minimized.

Copy link

TattiQ commented Jul 20, 2018

of course I agree that it's time to optimize influx for deletions and make it possible to drop measurements using regex. It's pretty easy to get a situation where a lot of them are created by some code and this needs to be handled somehow

@dmoebius

This comment has been minimized.

Copy link

dmoebius commented Jul 27, 2018

In this SO post someone mentions that DROP SERIES supports regexps. I cannot find this in the official v1.6 docs. Is it true?
What's the difference between DROP MEASUREMENT and DROP SERIES?!?

@AvinKumar

This comment has been minimized.

Copy link

AvinKumar commented Aug 2, 2018

@dgnorton dgnorton added the 1.x label Jan 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.