Hi Matt,

The behavior you're seeing is the result of InfluxDB's preset epoch time
boundaries <http://www.epochconverter.com/weeks/2017>. By default, InfluxDB
uses those preset time boundaries, not the time at which you created the
CQ, to define when a week begins and when a week ends. The current epoch
week starts on January 09, 2017 and ends just before January 16, 2017.

If you want to personalize the CQ time boundaries you can use an
offset_interval of one day in the GROUP BY time() clause:

CREATE CONTINUOUS QUERY weekly_data_cq ON db
BEGIN
  [...]
  GROUP BY id, time(1w,1d)
END

Check out example 4
<https://docs.influxdata.com/influxdb/v1.1/query_language/continuous_queries/#examples-of-basic-syntax>
in the docs for another example.

Just in case: I noticed you said you were seeing the time range Jan 10 up
to Jan 17, not Jan 09 up to Jan 16. I created a similar CQ with version
1.1.1 and saw, as I expected, January 09 up to January 16. If you are
indeed seeing Jan 10 up to Jan 17 let us know - that wouldn't be consistent
with the expected behavior.

I hope this helps! You're right - we don't have any examples with the
longer-term intervals in the docs. I'll work on getting something like this
added to the CQ doc or at least have an FAQ on it.

On Tue, Jan 10, 2017 at 2:50 PM, <[email protected]> wrote:

> On Tuesday, January 10, 2017 at 5:42:04 PM UTC-5, Matthew Guindin wrote:
> > I’m trying to downsample data on a weekly basis and am hitting a problem
> with the time range it's apparently running against.
> > I have a continuous query that looks like this:
> >
> >
> > CREATE CONTINUOUS QUERY weekly_data_cq ON db
> > BEGIN
> >     SELECT sum(count) as sum, last(*)
> >     INTO db.one_month.weekly_data
> >     FROM db.autogen.daily_data
> >     GROUP BY id, time(1w)
> > END
> >
> >
> > The data that's being recorded to `weekly_data` seems inconsistent
> somehow based on the day of the week this is run.  Am I misunderstanding
> something with the database?
> > When this runs today, it’s producing data for the week starting today
> and ending on the 17th, not from the 3rd to the 10th as I figured it would
> run.
> >
> >
> > I haven’t found documentation or examples using this large of a window
> since the documentation is using hours or minutes, so I’m not sure if this
> is a bug or if I’m not using the DB properly.
> >
> >
> > -Matt
>
> I forgot one additional part, the Continuous Query is running `RESAMPLE
> EVERY 30m FOR 1w`
>
> --
> 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/dcdd18a3-cade-4bca-9000-7f86fc95ffca%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 [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/CAKnH5VB0OWdWrws2Ngd8jUy1vnLDM8yvWad7jsW5%2B7Co5LQDcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to