Hello,
i have a very big database (toooo big) and I want to shrink it down BUT I don’t want to loose the data.
So I want to make a strategy and put some data in to a new bucket and want to aggregate the data.
That means, data that is older than a specific time i want to compress and write into the bucket. Additionally for all new coming values it should be done (via Tasks) automatically.
So I need two scripts mainly - I will write it down for one example:
- Data from now until - 6 months put in bucket with 5 minutes aggregation
- For the future automatically new data should be put into the 6 month archive. (via tasks writing every 1h ?)
Later I will make some more buckets for example to make the whole dataset as e.g. in an 1h average archive.
Questions:
- how do I do the downsampling ? I failed a lot up to now
- does this strategy make sense ?
- always a get a message in influx GUI that only 100MB will be handled ? I don’t understand the message
Here is what I have done up to now - any help is highly appreciated:
data =
from(bucket: "homeassistant")
|> range(start: 1900-01-01T00:00:00Z, stop: -2mo)
|> filter(fn: (r) => r["entity_id"] == "solarlog_verbrauch_ac")
|> filter(fn: (r) => r["_field"] == "value")
|> aggregateWindow(every: 1h, fn: mean)
data
|> to(bucket: "Downsample-6m-5m")