Does influx 2.7 support union kind of operation in subqueries ?
If not is there a way in influxql where pagination is possible on multiple measurements when searched at one? If i have measurement 1, measurement2, measurement3. Is there a way in java client that we can get total of 100 records of all three measurement ?
Hello @bkonduru,
Sorry for the delay, I was out of office.
So there isn’t union in InfluxQL. There also isn’t a way to group all data across measurements together
However you can perform multiple queries and then use java to union them together.
SELECT * FROM measurement1 WHERE time > now() - 1h LIMIT 100;
SELECT * FROM measurement2 WHERE time > now() - 1h LIMIT 100;
SELECT * FROM measurement3 WHERE time > now() - 1h LIMIT 100;
Hi @Anaisdg,
Thank you for your response. I have one more question regarding down sampling
Will there be performance impact if I downsample for each measurement using task which will run for every minute and grouped by each second for aggregate functions like count,min,avg.
Hello @bkonduru,
The effect of the number for tasks you have on performance depend on so many variables like hardware considerations, complexity of tasks, volume of data etc. It’s hard for me to say. You can downsample all the data in a bucket (all measurements) with one task tho:
To get the min count and avg I would do:
// Task Options
option task = {name: "cq-mem-data-1w", every: 1w}
// Defines a data source
data = from(bucket: "system-data")
|> range(start: -duration(v: int(v: task.every) * 2))
|> filter(fn: (r) => r._measurement == "mem")
data
// Windows and aggregates the data in to 1h averages
|> aggregateWindow(fn: mean, every: 1h)
// Stores the aggregated data in a new bucket
// rename measurement so you can keep track of the type of aggregation
|> rename(fn: (column) => if column == "_measurement" then "${column}_mean" else column)
|> to(bucket: "system-data-downsampled", org: "my-org")
data
// Windows and aggregates the data in to 1h averages
|> aggregateWindow(fn: count, every: 1h)
// Stores the aggregated data in a new bucket
// rename measurement so you can keep track of the type of aggregation
|> rename(fn: (column) => if column == "_measurement" then "${column}_count" else column)
|> to(bucket: "system-data-downsampled", org: "my-org")
data
// Windows and aggregates the data in to 1h averages
|> aggregateWindow(fn: min, every: 1h)
// Stores the aggregated data in a new bucket
// rename measurement so you can keep track of the type of aggregation
|> rename(fn: (column) => if column == "_measurement" then "${column}_min" else column)
|> to(bucket: "system-data-downsampled", org: "my-org")