user3567846
user3567846

Reputation:

How to downsample or clear data from autogen retention policy

I have implemented CONTINUOUS QUERIES and retention policies after our database has ingested a large amount of data. Namely I have RETENTION POLICIES and CONTINUOUS QUERIES for the following.

With the last day now being the default.

But of course I am left with the full resolution of data available in the default autogen policy. It appears I am unable to delete data on a per RETENTION POLICY basis. As such I would like to downsample the data I have in the autogen policy but am unsure of how to do so.

Upvotes: 1

Views: 2432

Answers (2)

iridos
iridos

Reputation: 11

You can just set the retention policy of autogen to something very small, just large enough for your continuous queries to have the data available for downsampling. e.g.

ALTER RETENTION POLICY autogen ON test DURATION 1h  SHARD DURATION 30m DEFAULT

Or you could set the autogen to 1d, as that is your shortest timespan and probably has full resolution anyway.

Upvotes: 1

WindyFields
WindyFields

Reputation: 2875

If you want to delete data in a specific retention policy run:

USE "database_name"."retention_policy"
DELETE FROM "measurement"

This will delete all the data from "measurement" table in "retention_policy" RP which is currently active. To use default retention policy run CLEAR rp. It will reset active retention policy to default (autogen in your case).

Downsampling data from default RP into last_day:

CLEAR rp

SELECT MEAN(value)
INTO "last_day"."measurement"
FROM "measurement"
GROUP BY time(1d)

Upvotes: 1

Related Questions