influxdata / influxdata/influxdb

Continuous queries are time dependent(?)

Open
#17,169 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Hi there! We use `influxdb` for storing trade candles and aggregate them by hour and day interval. We have such cq:
```
day CREATE CONTINUOUS QUERY day ON candles BEGIN SELECT first(open) AS open, max(high) AS high, min(low) AS low, last(close) AS close, sum(base_volume) AS base_volume, sum(quote_volume) AS quote_volume INTO candles.day.:MEASUREMENT FROM candles.minute./.*/ GROUP BY time(1d) END
```
Keypoint is there are `last`, `first`, `max` and `min` aggregation. But, resulting data is non-consistent:
```
> select * from candles.day.binance_DOGEUSDT order by time desc limit 2;
name: binance_DOGEUSDT
time base_volume close high low open quote_volume
---- ----------- ----- ---- --- ---- ------------
1583712000000000000 163524475 0.0022181 0.0022167 0.00208 0.0021714 352818.05889130005
1583625600000000000 136738799 0.0021792 0.0024039 0.0021651 0.0024029 311099.2201635999
```
You can see that `close` is bigger than `high`. Maybe there should be some tricks with cq to avoid such behavior?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied continuous-query definition and the sample SELECT output, then reproduce the inconsistent aggregation behavior. No files or tests are named in the issue; done means determining whether the result is expected, whether the query can avoid it, or what change is needed to make the aggregates consistent.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.