influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

Retention policy scope for delete commands

Open kostasb opened this issue 7 years ago • 39 comments

Feature request: Support retention policy scope for series deletion commands such as DROP MEASUREMENT , DROP SERIES , DELETE FROM.

Current behavior: Delete commands have database-wide scope. As a result, it is not possible to delete a measurement under a specific retention policy without having it deleted from all retention policies in the database it lives in.

Consider:

db1.rp1.measurement
db2.rp2.measurement

There is currently no way to drop the measurement or some series of it, from a specific rp.

kostasb avatar Mar 02 '17 17:03 kostasb

+1

jwyse avatar Apr 23 '17 17:04 jwyse

Oh man.

This thoroughly confused me when attempting to delete data. (on 1.3, due to supported libraries on .net)

  1. Chronograf fails to parse
DELETE FROM /.*/ WHERE "time" >= '2018-02-28T02:26:08.0000000Z' AND "time" <= '2018-02-28T02:27:08.0000000Z'

database not found

DELETE FROM "SensorData"../.*/ WHERE "time" >= '2018-02-28T02:26:08.0000000Z' AND "time" <= '2018-02-28T02:27:08.0000000Z'

received status code 400 from server: err: error parsing query: database not supported at line 1, char 1

When it works fine from command line as no database was specified, yet if you specific a database, it fails.

Additionally this prevents me from having a slightly more flexible schema. https://stackoverflow.com/questions/49022407/how-can-i-delete-measurements-within-a-time-range-for-a-given-rp

ryantheleach avatar Feb 28 '18 05:02 ryantheleach

this missing feature makes the use of retention policies and CONTINUOUS QUERIES hardly usable...

EugenNY avatar Mar 13 '18 22:03 EugenNY

+1

fanjun1980 avatar Aug 16 '18 02:08 fanjun1980

+1

alespour avatar Sep 27 '18 09:09 alespour

I created a few RPs to store aggregated data, created CQs to put new data in them, and backfilled them with some SELECT..INTO queries. Now I want to delete the old high-resolution data from the default RP.

  • If I use DELETE FROM telegraf.autogen.cpu WHERE time < now() - 30d, I get "ERR: error parsing query: retention policy not supported" (ie. this bug).
  • If I use DELETE FROM cpu WHERE time < now() - 30d, I would delete old cpu data for all RPs, including what I just aggregated.
  • If I alter the autogen RP to retain data for 30 days, I would delete old data for all measurements in the autogen RP rather than only cpu.

Looks like the only solution is to do the aggregated backfilling for all my measurements and only alter the RP when I'm completely done... for which I'll have to give my server a bigger disk first :sparkles:

nicolas17 avatar Oct 02 '18 04:10 nicolas17

This is a pretty serious hole - any ETA for implementation?

lansalot avatar Oct 26 '18 10:10 lansalot

Any roadmap for this feature?

akamac avatar Jan 21 '19 14:01 akamac

This is silly.

I did use database.autogen which said it switched to the database using a retention policy, and then drop measurement name which ended up deleting data from autogen AND another retention policy I had.

xPaw avatar Feb 01 '19 15:02 xPaw

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 23 '19 09:07 stale[bot]

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

stale[bot] avatar Jul 30 '19 09:07 stale[bot]

This needs to be reopened and addressed.

akamac avatar Jul 30 '19 15:07 akamac

Oh My goodness. I cam across this issue to day when I had to delete some data from the default retention and the from another downgraded retention. And all I get is: ERR: error parsing query: retention policy not supported at line 1, char 1

This is a high priority issue.

What is the point of DELETE if it cannot be applied to retention policies.

hanynowsky avatar Sep 18 '19 14:09 hanynowsky

'wontfix'ing this is sinful.

andydavidson avatar Oct 04 '19 11:10 andydavidson

Yes, clearly "stale bot" closed this one in error, someone with the authority to do so needs to mark this as re-opened.

James00001 avatar Oct 04 '19 12:10 James00001

still needed

foobar avatar Apr 27 '20 07:04 foobar

Re-opened. This issue was closed automatically for being stale but is a valid issue.

dgnorton avatar Sep 08 '20 13:09 dgnorton

this is insane. data was written to a 360d retention policy accidentally. is there seriously no way to fix this? we're just stuck with ~15 minutes of data for all our users for 360d? redis timeseries is looking like its worth investigating at this point between this and other influxDB-isms...

Edit: check out https://questdb.io/ if you're not stuck with influx

stevenaldinger avatar Jan 18 '21 02:01 stevenaldinger

Same issue. 3 years ongoing, seriously? I can do a select * from "oneyear"."HVAC" but no way to get rid of the records.

teichhei avatar Feb 04 '21 05:02 teichhei

Same issue, 3 years for basic delete feature) So the only way to do it is to:

  1. move data to another table with default infinite RP
  2. drop original table
  3. delete needed data in this tmp table with default RP
  4. move data back to new table with the same name and RP

It is ugly, but at least it will do the job

andriy-pankiv-lemberg avatar Apr 06 '21 10:04 andriy-pankiv-lemberg

:+1: I do also need this feature

kszarlej avatar Apr 19 '21 17:04 kszarlej

so over 4 years, no comments, no ETA. if the problem is not regarding Flux QL it's not getting attention? This is ridiculous

SadSadko avatar May 05 '21 12:05 SadSadko

+1 also need this feature. Without it we have to get things perfect first time around, every time, which is unrealistic.

LeonChadwick avatar Nov 10 '21 09:11 LeonChadwick

+1 This is needed

sfawcett123 avatar Feb 08 '22 10:02 sfawcett123

+1

merrilmathew avatar Feb 08 '22 11:02 merrilmathew

Still waiting for it

mrwogu avatar Apr 08 '22 11:04 mrwogu

Still waiting

mac-lucky avatar Aug 10 '22 13:08 mac-lucky

+1

barrettathome avatar Sep 06 '22 20:09 barrettathome

+1

ascha191 avatar Nov 24 '22 07:11 ascha191

+1

firesgc avatar Dec 27 '22 16:12 firesgc