How to downsample or clear data from autogen retention polcy?

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.

  • The last year
  • The last month
  • The last week
  • The last day

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.

To roll up old data it should be as simple as running your query over the full duration of time in the autogen retention policy. So, if you have a CQ like

CREATE CONTINUOUS QUERY "counter-5m-rollup" ON "tubular-metrics"
BEGIN
SELECT mean(value) AS value INTO "metrics"."last_week".:MEASUREMENT FROM "metrics"."autogen"./.*/ GROUP BY time(5m), *
END

You could just run something like the following to roll up the last 30 days

SELECT mean(value) AS value INTO "metrics"."last_week".:MEASUREMENT FROM "metrics"."autogen"./.*/ WHERE time > now() - 30d GROUP BY time(5m), *

Once you have downsampled it’s just a matter of dropping the retention policy.

DROP RETENTION POLICY 'autogen' ON 'metrics'

Ah OK I hadn’t thought to actually drop the autogen retention policy itself. I’ll try that later today, thanks.

Edit: Yup that worked, thanks.