est
November 28, 2017, 8:07am
1
Hi,
I have a measurement looks like this:
hits host
1 server_a
1 server_a
1 server_b
I want to aggregate it into per second like
hits host
2 server_a
1 server_b
WHat’s my best approach to do this?
Everytime I try SELECT COUNT(hits), host … GROUP BY influxdb says
ERR: error parsing query: mixing aggregate and non-aggregate queries is not supported
katy
December 4, 2017, 8:04pm
2
The problem is that host (assuming host is a tag) can’t be used with an aggregate. In order preserve your tags and aggregate along the host dimension, have a GROUP BY *
SELECT count(hits) as hits
FROM <measurement>
WHERE <time condition>
GROUP BY time(1s), *
1 Like
est
December 7, 2017, 6:57am
3
Hello Katy,
Thanks for the reply, I am actually trying to create a CQ by downsampling hits
fields by aggregate by every 1 seconds.
However, my main problem is that I lost all tags info like the host
in the above example.
I am trying to get
SELECT COUNT(hits) as hits, host FROM ... GROUP BY time(1s), host
but it does not work.
Influxdb will result
ERR: error parsing query: mixing aggregate and non-aggregate queries is not supported
est
December 7, 2017, 7:02am
4
OK now I get it, Influxdb will automatically add tags if GROUP BY time(1s), *
. Case closed.
2 Likes