The CQ will not use epoch 0 as the lower bound, it will explicitly set the lower bound. If you use the GROUP BY time(522w), you'll need to use the RESAMPLE clause to make sure it runs more often than every 10 years.
For example, CREATE CONTINUOUS QUERY foo ON mydb RESAMPLE EVERY 5m SELECT COUNT(*) FROM car GROUP BY time(522w) END That will run the CQ every 5 minutes over the last 522w of data. Read up on the time interval boundaries on the CQ docs page and the GROUP BY clause docs: https://docs.influxdata.com/influxdb/v0.13/query_language/continuous_queries/ https://docs.influxdata.com/influxdb/v0.13//query_language/data_exploration/#group-by-time-intervals On Tue, Aug 23, 2016 at 5:49 PM, Emiliano Heyns < [email protected]> wrote: > Ah, the error was easily addressed ("select count(*) from car where time > > now() - 522w group by time(522w)"), but that leaves the question on how I > should do the CQ when I ought not to include a time range, and the fixed > query still nets me 5 rows. Doesn't really matter as I can just request > "last(..)" from the results of the CQ right? > > On Wed, Aug 24, 2016 at 1:45 AM, Emiliano Heyns < > [email protected]> wrote: > >> OK, I see. >> >> I get an error for that specific query, but it should in any case not be >> a problem to filter out the zero-rows. >> >> If you don't mind me asking, how do I craft a CQ from this? The docs say >> "Because CQs run on regularly incremented time intervals you don't need to >> (and shouldn't!) specify a time range in the `WHERE` clause." >> >> On Wed, Aug 24, 2016 at 12:45 AM, Sean Beckett <[email protected]> wrote: >> >>> Ahh, okay. That makes perfect sense. You issued a GROUP BY time(10 >>> years) query with no explicit time range. Therefore the first bucket starts >>> at the default lower bound, which is epoch 0. Then you see a result for >>> each 10 year bucket, and the final result holds the actual data you've >>> written, since that's all in the 40-50 year decade since epoch. >>> >>> To get only a single line, use >>> >>> select count(*) from car where time > 0 group by time(522w) WHERE time > >>> now() - 522w >>> >>> or something like >>> >>> select count(*) from car where time > 0 group by time(522w) WHERE time > >>> '2007-01-01' >>> >>> On Tue, Aug 23, 2016 at 4:36 PM, Emiliano Heyns < >>> [email protected]> wrote: >>> >>>> On Wed, Aug 24, 2016 at 12:30 AM, Sean Beckett <[email protected]> >>>> wrote: >>>> >>>>> Can you share the output from "select count(*) from car where time > >>>>> 0 group by time(315360000s)"? >>>>> >>>>> >>>> Sure: https://gist.github.com/anonymous/6e064df2baae476dfc62 >>>> 3bcb2f8eae5a >>>> >>>> >>>> -- >>>> Remember to include the InfluxDB version number with all issue reports >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "InfluxDB" 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/ms >>>> gid/influxdb/CAHOSGO54qntocRe2CyjXH9qgu9DtnRfZy0p2N_J71xpjtH >>>> -iBA%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/influxdb/CAHOSGO54qntocRe2CyjXH9qgu9DtnRfZy0p2N_J71xpjtH-iBA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Sean Beckett >>> Director of Support and Professional Services >>> InfluxDB >>> >>> -- >>> Remember to include the InfluxDB version number with all issue reports >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "InfluxDB" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/to >>> pic/influxdb/eUrSfCRi8_c/unsubscribe. >>> To unsubscribe from this group and all its topics, 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/ms >>> gid/influxdb/CALGqCvO6mzfs4LFAwusy9VRE9cEOBNkDJNZx%2BNPEdWuj >>> x_YiNA%40mail.gmail.com >>> <https://groups.google.com/d/msgid/influxdb/CALGqCvO6mzfs4LFAwusy9VRE9cEOBNkDJNZx%2BNPEdWujx_YiNA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- > Remember to include the InfluxDB version number with all issue reports > --- > You received this message because you are subscribed to the Google Groups > "InfluxDB" 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/CAHOSGO4YT%2BacUFB5w7M8czLSFsGqgO8zDdcwx% > 3D4gO6X2xi79jw%40mail.gmail.com > <https://groups.google.com/d/msgid/influxdb/CAHOSGO4YT%2BacUFB5w7M8czLSFsGqgO8zDdcwx%3D4gO6X2xi79jw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- Sean Beckett Director of Support and Professional Services InfluxDB -- Remember to include the InfluxDB version number with all issue reports --- You received this message because you are subscribed to the Google Groups "InfluxDB" 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/CALGqCvONvm1dqOte7%3D%2BMbtsh5F61MoKHd%3Dy8_mUZ7_VT_DmB8w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
