Continuous query are not executed as required

Hi!
I wrote a CQ for InfluxDB version 1.76 with ‘RESAMPLE FOR 20s’ and ‘GROUP BY time(10s)’, but if look at the log file, the CQ only runs once a minute.I don’t understand why. Who can explain to me why this is so? )

For example:
CQ:
CREATE CONTINUOUS QUERY packets_b ON apr RESAMPLE FOR 20s BEGIN SELECT sum(value) AS packets INTO apr."default".packets_b FROM apr."default".b_stats GROUP BY time(10s), packet_type, dc END

what we can see in log file:

Jul 15 03:27:49 srv1 influxd: ts=2021-07-15T00:27:49.746175Z lvl=info msg="Executing continuous query" log_id=0U6kmqaW000 service=continuous_querier trace_id=0VLtqYSW000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-07-15T00:26:00.000000Z end=2021-07-15T00:26:50.000000Z
Jul 15 03:28:55 srv1 influxd: ts=2021-07-15T00:28:55.755116Z lvl=info msg="Executing continuous query" log_id=0U6kmqaW000 service=continuous_querier trace_id=0VLtu_Il000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-07-15T00:26:40.000000Z end=2021-07-15T00:27:50.000000Z
Jul 15 03:29:46 srv1 influxd: ts=2021-07-15T00:29:46.994564Z lvl=info msg="Executing continuous query" log_id=0U6kmqaW000 service=continuous_querier trace_id=0VLtxhSW000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-07-15T00:27:40.000000Z end=2021-07-15T00:28:50.000000Z
Jul 15 03:30:39 srv1 influxd: ts=2021-07-15T00:30:39.773191Z lvl=info msg="Executing continuous query" log_id=0U6kmqaW000 service=continuous_querier trace_id=0VLt~vcG000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-07-15T00:28:40.000000Z end=2021-07-15T00:29:40.000000Z
Jul 15 03:31:37 srv1 influxd: ts=2021-07-15T00:31:37.074484Z lvl=info msg="Executing continuous query" log_id=0U6kmqaW000 service=continuous_querier trace_id=0VLu3QSW000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-07-15T00:29:30.000000Z end=2021-07-15T00:30:40.000000Z
Jul 15 03:32:25 srv1 influxd: ts=2021-07-15T00:32:25.931035Z lvl=info msg="Executing continuous query" log_id=0U6kmqaW000 service=continuous_querier trace_id=0VLu6PIl000 op_name=continuous_querier_execute name=packets_b db_instance=apr start=2021-07-15T00:30:30.000000Z end=2021-07-15T00:31:30.000000Z

Might be settings of InfluxDB.

[continuous_queries]
  run-interval = "1s"

See:

piece from my config file:

[continuous_queries]
  # Determines whether the continuous query service is enabled.
  # enabled = true
  # Controls whether queries are logged when executed by the CQ service.
  # log-enabled = true
  # Controls whether queries are logged to the self-monitoring data store.
  # query-stats-enabled = false
  # interval for how often continuous queries will be checked if they need to run
  # run-interval = "1s"

What’s the default value for run-interval ? I think: 1s

Yeah, the default should be 1sec.

It should behave as you expect, so being executed with the interval specified in the GROUP BY, I have no idea why that does not happen.

You can try to use EVERY to force the execution frequency, let me know if this helps

see:

Thanks! I’ll try this case and write result

Sorry for taking so long, problem on the prod server. I checked CQ using “EVERY” but it didn’t help. Also I uncommented: run-interval = “1s”. But still, CQs are executed only once every 50-60 seconds. Can’t figure out what the problem is.

At this point I have no clue… I had a look at the past patch notes but there are no bugs/fixes on CQs after 1.4.0

You can open an issue on Github, you may have better luck there.

In the meantime, you can try a workaround by using a wider range with lower frequency, something like

CREATE CONTINUOUS QUERY packets_b ON apr RESAMPLE EVERY 1m FOR 2m BEGIN SELECT sum(value) AS packets INTO apr."default".packets_b FROM apr."default".b_stats GROUP BY time(10s), packet_type, dc END

@Anaisdg have you ever seen/heard this problem?

ok, thanks for trying! )