Search code examples
databasetime-seriesinfluxdb

Time series database with time-weighted-average aggregation function for irregular time series?


Our sensors produce values in irregular time intervals:

12:00 10 12:02 20 12:22 30 12:29 40

I am trying to find a time series database that can automatically calculate the average value for certain regular time intervals (e.g. 10min). Of course the longer a value was valid within the interval the more weight it has in the average (time weighted average). (e.g. 12:00-12:10: (10*2+20*8)/10=18) )

I am searching now on the internet for hours and found lots of time series databases that talk about irregular time series (e.g. InfluxDB, OpenTDSB, etc.) and most of them have some SQL-like query language with aggregation functions.

Unfortunately they don't say how exactly irregular time intervals are averaged. As I don't want to try all of them, can someone tell me which databases support the calculation of a time-weighted-average? Thanks!


Solution

  • OpenTSDB performs aggregation across all series in a query at the time(s) implied by the query. For any series not having a data value at a timestamp, it linearly interpolates a value from the values before and after. It does this "upsampling" at query time -- the original data is always stored as it was when it arrived. You can perform a trailing windowed time average, but not an exponentially weighted moving average (I believe that is what you meant by time-weighted?)

    http://opentsdb.net/docs/build/html/user_guide/query/aggregators.html

    (I should add, that's not a blanket recommendation for OpenTSDB as the db you should use, I'm just responding to your question)