Андрей Лавриненко
2017-11-06 09:03:48 UTC
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.
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.
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.