Is here anybody who has got hands on multiple retention policy when dealing with influxdb persistence?
If I understand documentation of influx properly, it is configurable on DB level not on data level, if so, multiple databases would be needed for multiple retention policy - eg. one for forever, one for year, rest with shorter term
and in OH, is it even possible to use 2 or more separate persistence of same type? is so, how as there is only one cfg file per db type?
Or is there another way? eg. setting data retention in OH when sending them for persistence somehow?
I do not believe it is possible to have more than one database of any give type (i.e. you only get one InfluxDB database).
You can define multiple retention policies per database. See https://docs.influxdata.com/influxdb/v1.7/guides/downsampling_and_retention/. And you can define the continuous queries so they only deal with certain data in that database. So I would expect OH to write to a “default” retention policy. Continuous queries would run to move the data that you care about (perhaps down sampled) to other fields that have your other retention policies applied.
Interesting thread, was wondering about the same thing. I’ll have to look up continuous queries to copy data items to other retention policies, looks promising.
As far as openHAB is concerned, it does not need to know about the different retention policies.
If you try to access a value for a persisted item you’ll either get a value or not, depending on where the continuous queries moved them (long- mid- or short-term).
But checking for null values should be default for persisted items, most of the time you’ll never really know if you’ll have a value for a specific point in time anyway
yeah, well if OH can use only one db by design, then I don’t see any solution than to have some kind of relation gateway which will call proper DB per request eg. requesting “_long_weather” -> get data from Influx longterm DB
But this is something which I was not able to find any solution for, but on the other hand, haven’t been searching much actively tho