Storing time critical industrial sensor values

hello,
i set up a testing rig to explore new solutions for industrial sensors and actuator data storage in a timeseries database.
i am reading around 500 signals (digital and analog hardware inputs and or outputs) from 2 plcs in every 250ms (yes, and this is just the test environment, the real application has around 1k unique signals with a 150ms sample time).
i am writing the sensor data into a bucket, then in a measurement named factory, then a unique tagname for each machine and then the field and value for every machine’s sensor (1 bucket, 1 measurement, 2 machine tags, 500 fields (signals, temperature, current, voltage, switches, etc.) (250 for mahchine 1 and 250 for machine 2).
i want to plot the signals in grafana dynamically (sometimes 10 lines on the same trend).
the datasource query is pretty generic:

from(bucket: “bucketname”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “factory”)
|> filter(fn: (r) => contains(value: r[“_field”], set: ${workbench:json}))

where the variable workbench is the dropdown list and i can select the sensors to plot.
i have the following problem:
while the writing into influxdb has no issues data or resource wise, when i open a browser and grafana then change the time range to greater than 30 minutes, the usage statistics will show 100% cpu usage for influxdb and i get timeout errors (nomatter how many cores or ram i allocate to the vm).
i changed every timeout to at least 2 minutes in grafana and influxdb without any visible result.
did i reach the limits of influxdb (oss)? the data is written without issues, the query is the problem an since grafana reports the timeout is from influxdb i thought i post it here.
this downsampling thing is not an option.
influxdb2 v2.7.9 (oss) , ubuntu 24.04 LTS, nodered 4.0.2., grafana 11.1.3

thank you kindly for your input.

Hi @biros

Do you get any results when trying to graph your query in Influx Data Explorer (forgetting for the moment about the variable workbench…just hard code that to a given value and see how/if it works).

I believe there was a recent bug in Grafana re: Influx variables, but don’t quote me on that.