Discussion:
[influxdb] Help with Continuous Query
Андрей Лавриненко
2017-11-06 09:03:48 UTC
Permalink
Hi all.


I need some help with Continuous Query.


I have next measurement ‘test’:

- value (filed).
- event (tag).
- direction (tag).


For example:
time direction event value
1509463455 “direction1” “event1” 12
1509463456 “direction1” “event1” 14
1509463457 “direction1” “event2” 18
1509463458 “direction1” “event2” 10
1509463459 “direction1” “event3” 15
1509463460 “direction2” “event2” 10
1509463461 “direction2” “event2” 15


My problem is: I need to create Continuous Query, that I can calculate SUM
of values GROUP BY direction and event.


Ok, I have wrote next Continuous Query:
CREATE CONTINUOUS QUERY “cq_test” ON "telegraf"
RESAMPLE EVERY 1d
BEGIN
SELECT SUM(value) INTO “test_sum” FROM “test” GROUP BY direction, event,
time(1h)
END


But, this CQ calculates total SUM by all events group by one direction.
Therefore, I got:
time direction value
1509463455 “direction1” 69
1509463456 “direction2” 25


But, I want to get something like this:
time direction event value
1509463455 “direction1” “event1” 26
1509463457 “direction1” “event2” 28
1509463459 “direction1” “event3” 15
1509463460 “direction2” “event2” 25


Please, could you clarify, how can I do it (if it possible by CQ)?


Thank you in advance.
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/9492806e-480a-4242-8f9e-dd1070ba2250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...