Grafana: FLUX vs InfluxQL

Hi Team,

Please see the below Grafana error on the topic of InfluxQL vs FLUX.

A query returned too many datapoints and the results have been truncated at 15511 points to prevent memory issues. At the current graph size, Grafana can only draw 1551. Try using the aggregateWindow() function in your query to reduce the number of points returned.

Dashboard using Flux query language

I do not see this error when I used InfluxQL as language type

SELECT “Percent_Processor_Time” FROM “Processor” WHERE (“Site_ID” =~ /^$Site_ID$/ AND Environment =~ /^$Environment$/ AND instance = ‘_Total’) AND $timeFilter GROUP BY “Site_ID”

One is Flux another is InfluxQL and it pulls equal number of datapoints, while flux throws this error InfluxQL does not.

@davidharris @grant2 @usman.ahmad tagging for attention please :pray:

NB. This was asked before but didn’t recieve any attention hence raising again:

I don’t think both queries return the same amount of data points, have no experience with InfluxQL but I think you query is already down sampling the data points.

but the solution is there: Try using the aggregateWindow()

on Flux, if you do not specify the aggregate window the server returns all data points within the time range, that means I.E if you have 1 data point each 1s it will return all 604,800 data points.

this line: |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false) will get you last data point in each window (automatically determined by Grafana based on time range).

you can also change the function last, to first, min, max, mean etc…