influxdata / influxdata/influxdb

Continuous query does not calculate averages for all values of a tag

Open
#7,627 12 comments 0 reactions 1 assignee Claimed by @rbetts View on GitHub
1.x area/continuous queries kind/bug pending pm/review
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

### Bug report

I have one large measurement in my database, called `log_record`. This measurement stores sensor values for a lot of sensors. There are two retention policies:

1) four_weeks; contains four weeks of "raw" sensor data, about 10s interval
2) forever; contains averages over 2 minutes and keeps that data forever

Averages in the `forever` retention policy are calculated using this continuous query:

```sql
CREATE CONTINUOUS QUERY cq_aggregate_log_record ON mydb
BEGIN
SELECT mean(value) AS value
INTO mydb.forever.log_record
FROM mydb.four_weeks.log_record
GROUP BY time(2m), *
END
```

However, some series are not handled by this query, so their data is not averaged and saved in the forever retention policy, even though they have data in the four_weeks retention policy.

When I manually execute the exact same query, averages are correctly calculated for all series.

I have manually removed and added the continuous query to no avail.

I have also added a new continuous query, that specified a certain sensor_id, like this:

```sql
CREATE CONTINUOUS QUERY cq_aggregate_log_record ON mydb
BEGIN
SELECT mean(value) AS value
INTO mydb.forever.log_record
FROM mydb.four_weeks.log_record
WHERE sensor_id='4790'
GROUP BY time(2m), *
END
```

And this continuous query *also* does not work, so averages are *not* calculated, even when specifying a value for the sensor_id.

__System info:__
InfluxDB 1.1
Ubuntu 16.10

__Steps to reproduce:__
Hard to say...

__Expected behavior:__
Continuous query should calculate averages over 2 minute periods for every series in the measurement.

__Actual behavior:__
Averages are only calculated for about 70 or 80% of series, rest isn't handled at all.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.