CQ gives different result then same query on original measurement

I’m having an issue with the result of my continuous query.
My original measurement contains the counter/teller of my gas meter (increasing value). In order to get the actual gas-usage I query with a non_negative_derivative on the last value (see below).
The query itself on the original measurements gives a perfect result, but using it as a continuous query gives gaps in the result (it always skips the first result after there was no gas usage in the previous interval).
Below are the CQ and the result of the last 6 hours on both the original measurement as wel as the downsampled measurement (and a grafana screen to visualize it).

I’m using InfluxDB 1.8.10-1 armhf (raspberry pi)

Any idea what’s going wrong?

show CONTINUOUS queries

name: _internal
name query


name: p1energymeter
name query


cq_gas_5m CREATE CONTINUOUS QUERY cq_gas_5m ON p1energymeter BEGIN SELECT non_negative_derivative(last(value)) AS gasverbruik INTO p1energymeter.“5_weeks”.downsampled_gas_usage FROM p1energymeter.“1_week”.“Gas-usage” GROUP BY time(5m) END

SELECT non_negative_derivative(last(value)) AS gasverbruik FROM p1energymeter.“1_week”.“Gas-usage” where time > now()-6h GROUP BY time(5m)
name: Gas-usage
time gasverbruik


1671804000000000000 0.11999999999989086
1671804300000000000 0.07000000000061846
1671804600000000000 0.07999999999992724
1671804900000000000 0.019999999999527063
1671806100000000000 0.005000000000109139
1671811500000000000 0.0005555555555676821
1671811800000000000 0.009999999999308784
1671812100000000000 0.14000000000032742
1671812400000000000 0.1000000000003638
1671812700000000000 0.07999999999992724
1671813000000000000 0.05999999999949068
1671815400000000000 0.0012500000000272848
1671815700000000000 0.02999999999974534
1671816000000000000 0.030000000000654836
1671816300000000000 0.019999999999527063

select * from p1energymeter.“5_weeks”.downsampled_gas_usage where time > now()-6h
name: downsampled_gas_usage
time gasverbruik


1671804300000000000 0.07000000000061846
1671804600000000000 0.07999999999992724
1671804900000000000 0.019999999999527063
1671811800000000000 0.009999999999308784
1671812100000000000 0.14000000000032742
1671812400000000000 0.1000000000003638
1671812700000000000 0.07999999999992724
1671813000000000000 0.05999999999949068
1671815700000000000 0.02999999999974534
1671816000000000000 0.030000000000654836
1671816300000000000 0.019999999999527063

Hello @rutgerpuntnet,
Unfortunately there isn’t much support around CQs anymore. I’ll ask around but I’m not sure what could be causing this.