Hi,

I would like to create continuous queries to precompute the top 5 values from a 
given table that holds say the mean cpu consumption of a set of devices. 

Here is the CQ

CREATE CONTINUOUS QUERY top5cq  ON metrics RESAMPLE EVERY 1h FOR 24h BEGIN 
SELECT top(mean_cpu, 5) as mean_cpu, serial_id INTO metrics."cq_rp".top5 FROM 
metrics."cq_rp".agg_metrics GROUP BY time(24h)  END

Here is the query as echoed in the query logs

SELECT top(mean_cpu, 5) AS mean_cpu, serial_id FROM metrics.cq_rp.agg_metrics 
WHERE time >= '2017-01-09T00:00:00Z' AND time < '2017-01-10T00:00:00Z' GROUP BY 
time(1d)

time                    mean_cpu                serial_id
----                    --------                ---------
1483920000000000000     68                      192.168.1.4_8888
1483920000000000000     65.71666666666667       192.168.1.5_8888
1483920000000000000     64.08333333333333       192.168.1.1_8888
1483920000000000000     63.416666666666664      192.168.1.2_8888
1483920000000000000     62.888888888888886      192.168.1.6_8888

The query returns the top 5 as expected but the only one point is reflected in 
the top5 series since the results are all on the same timestamp

> select * from metrics."cq_rp".top5
name: top5
time                    mean_cpu                serial_id
----                    --------                ---------
1483920000000000000     62.888888888888886      192.168.1.6_8888

What could I do to ensure all 5 data points are available precomputed ?

Thanks,
Rajesh

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/22b9d83b-2ec2-437d-ae37-92b4265db255%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to