we have a bunch of data stored in a local influx database. On top of that data we implement a condition monitoring system, where several fields stored in the influxdb are combined like
if temperature > 60 AND machineState == 128
We only store changes of raw data in the influxdb to keep the amount of storage as low as possible. This works fine for all other use cases we implemented. Some of that data changes quite frequently (ms) and others might change irregularly on an hour basis or even longer. So by combining two data points of different characteristics we only get spare results meaning lots of NULL entries. Please have in mind that we will constantly trigger those condition checks within a few seconds and finding the last valid value of low frequency data might go back in time for quite long (edge case: days). We want to keep complexity of queries low and its performance very high.
We are looking for a mechanism / query etc. that returns the last valid (not NULL) data point without using TIME boundary information in the where clause. In an ideal case there was a “sticky bit” telling a data point to be available in some sort of a lookup table or view onto the raw data, where always the latest valid (not NULL) data point is accessible.
Do you have any suggestions on how to solve that issue? Thank you very much.