# Time issue with Continuous Query

**URL:** <https://community.influxdata.com/t/time-issue-with-continuous-query/24508>\
**Category:** Systems\
**Tags:** influxdb, query, retention-policy\
**Created:** [April 2, 2022, 10:30am UTC](https://community.influxdata.com/t/time-issue-with-continuous-query/24508 "2022-04-02T10:30:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![solarflor](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@solarflor](https://community.influxdata.com/u/solarflor)\
**Post date:** [April 2, 2022, 10:30am UTC](https://community.influxdata.com/t/time-issue-with-continuous-query/24508/1 "2022-04-02T10:30:59Z")

</div>

Hi all,  
Let me start saying I’m quite new with Influx and databases in general.  
With my Rasberry I’m trying to build a system to monitor energy consumpion.

Hi have cretated a Influx DB callen “Energy\_Meter” and the following retention policies:

```auto
> show retention policies
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 48h0m0s 24h0m0s 1 false
2_days 48h0m0s 24h0m0s 1 true
hour_year 8736h0m0s 168h0m0s 1 false
day_infinite 0s 168h0m0s 1 false

```

I have also create two continuous queries;

```auto
> show continuous queries
name: _internal
name query
---- -----

name: Energy_Meter
name query
---- -----
cq_1h_energy CREATE CONTINUOUS QUERY cq_1h_energy ON Energy_Meter BEGIN SELECT integral(value) / 3600 AS value INTO Energy_Meter.hour_year."shellies/shellyem-C45BBE77DB37/emeter/0/power" FROM Energy_Meter."2_days"."shellies/shellyem-C45BBE77DB37/emeter/0/power" GROUP BY time(1h), entity_id TZ('Europe/Rome') END
cq_1d_energy CREATE CONTINUOUS QUERY cq_1d_energy ON Energy_Meter BEGIN SELECT integral(value) / 3600 AS value INTO Energy_Meter.day_infinite."shellies/shellyem-C45BBE77DB37/emeter/0/power" FROM Energy_Meter."2_days"."shellies/shellyem-C45BBE77DB37/emeter/0/power" GROUP BY time(1d), entity_id TZ('Europe/Rome') END
>
The problem I have is that while with the default retention I can see the correct value of the last two days, using the "day_infinite" retention I could see the measurement of all days (as it shoul be) but shifted of one day.
I mean the measure of day n (bottom graph) is visble as day n-1 (top graph).

```

 ![grafana](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/1/1d824a82342050c70decbe05f0fbfdffaf23114f.jpeg)

Not sure what I did wrong.  
Thanks for your support.

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [April 6, 2022, 2:50pm UTC](https://community.influxdata.com/t/time-issue-with-continuous-query/24508/2 "2022-04-06T14:50:01Z")

</div>

Hello @solarflor,  
Welcome!  
First may I ask if you’re new to InfluxDB, why are you running 1.x instead of 2.x?  
Can you help me understand your problem better? The first CQ is running as expected but the second CQ is shifting the result by 1 day? If so that’s strange, the retention policy shouldn’t have an effect on the way that CQ transforms the data (just the number of points potentially).

---

<div class="post-metadata">

**Author:** ![solarflor](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@solarflor](https://community.influxdata.com/u/solarflor)\
**Post date:** [April 6, 2022, 7:24pm UTC](https://community.influxdata.com/t/time-issue-with-continuous-query/24508/3 "2022-04-06T19:24:41Z")

</div>

Hi Anaisdg,  
yes, I’m new to InfluxDB. I’m using Influx 1.8.10 on my Raspberry Pi but don’t ask me why.  
Just following a guideline I found on intranet.  
Do you suggest I go to 2.x? it works on Debian 32 bit?

Yes, the problem is that I can see the results of yesterday 4th Apr generated with raw data

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/0/08418014af7260b9bbd3365b50eaf15d27dc5735.jpeg)

plotted as 3rd Apr if I use the agreggation mentioned above

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/f/fb188b58b6e710670611183fca29e7fe14dcbbf4.jpeg)

---

<div class="post-metadata">

**Author:** ![solarflor](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@solarflor](https://community.influxdata.com/u/solarflor)\
**Post date:** [April 13, 2022, 7:14pm UTC](https://community.influxdata.com/t/time-issue-with-continuous-query/24508/4 "2022-04-13T19:14:35Z")

</div>

Hi all,  
any idea to solve this timing issue?  
Thanks
