Downsampling and retention (v2)


I am new to influx and trying to work out out how retention and downsampling works.

  • As far as I understand, retention enforcement service runs every 30 mins and will delete data older than retention.
  • Downsampling is a task that aggregates data from main bucket to other bucket. Task is performed by the specified interval.

My question is, how do I make sure data is downsampled before it is deleted?


Bucket_main: retention policy = 30d
Downsampling task:

option task = {name: “downsampling-test”, every: 1d}
data =
from(bucket: “Bucket_main”)
|> range(start: -14d)
|> aggregateWindow(every: 1d, fn: count, createEmpty: false)

Is not in theory possible that data will be deleted before downsampling task is run?


Hello @Treebeard,
I don’t think so because you’re querying data from the last 14days and only data older than 30days will be delete.

Now if your range in your task was -30d then yes maybe.

I hope that helps :slight_smile:

Thanks! In that case, would I be correct in assuming that downsampling task execution time and range must be lower than the original bucket retention policy?

Because in documentation it states:

If running a task against a bucket with a finite retention period, do not schedule tasks to run too closely to the end of the retention period.