The primary use case for increase() is tracking changes in counter values which may wrap overtime when they hit a threshold or are reset. In the case of a wrap/reset, increase() assumes that the absolute delta between two points is at least their non-negative difference.
So far I haven’t found anything corresponding in the list of SQL functions for InfluxDB 3. What is the best way to deal with wrapped or reset counters?
In InfluxDB 3 SQL, there is no direct equivalent to Flux’s increase() or InfluxQL’s NON_NEGATIVE_DIFFERENCE(), but you can replicate it using window functions like LAG() to compute non-negative differences and SUM() OVER() for cumulative totals on counter values.
Thanks a lot for your replay. At the moment I am using lag() to calculate the difference and greatest(0, ..) to filter out negatives. Do you have an example or a place where I can look up how to use sum() and over() within my interval to aggregate the positives then?