I am using InfluxDB as a storage for a measurement MyMeasurement
, which counts occurrences of some event in 30s windows, for example:
time value
---- -----
1507107180000000000 0
1507107210000000000 0
1507107240000000000 7
1507107270000000000 0
1507107300000000000 1
1507107330000000000 2
What I want to extract from this measurement is a total count of all events from the very beginning until now. I can achieve this with:
SELECT cumulative_sum("value") from "MyMeasurement"
which returns results as expected:
time cumulative_sum
---- --------------
1507107180000000000 0
1507107210000000000 0
1507107240000000000 7
1507107270000000000 7
1507107300000000000 8
1507107330000000000 10
However, similar query cannot be applied as a continuous query:
CREATE CONTINUOUS QUERY "cumulativeSumForMyMeasurement" ON "MyDatabase"
BEGIN
SELECT cumulative_sum("value")
INTO "CumulativeSumForMyMeasurement"
FROM "MyMeasurement"
END
The error message is:
ERR: error parsing query: found MyMeasurement, expected GROUP BY time(...) at line L, char C
My question is how I can compute cumulative sum of measurement’s value from the beginning until now within a continuous query? Are there some restrictions imposed on continuous query I am not aware? Is there any workaround?