Problem with the Graph Panel and the query

Good morning to all

We would like to use Grafana to evaluate a measurement data acquisition. However, there are very big performance problems. The data is stored in a MySQL database. The dashboard contains a variable to select the measurement point (77 pieces). If the dashboard is loaded now, it takes at least 3 minutes to display the data. Apparently Grafana preloads the complete table with all measuring points and all times (in total about 25 million records). Actually, only the data of the selected measuring point and the selected time period of the last 12 hours should be loaded.

How can we avoid that the complete database is preloaded?

The query of the variable looks like this:

SELECT MeasurinPoint  

AS __value, CONCAT(MeasurinPoint, ’ - ’ ,SensorRemark) AS __text
FROM vw_list_of_measuringpoints

And the query of the Graph Panel looks like this:

SELECT

__timeGroupAlias(QueryTime,__interval),
/* QueryTime AS time, */
SensorUnit AS metric,

MeasuredValue AS “WERT”,
LimitValueMax AS “MAX”,
LimitValueMin AS “MIN”
FROM tbl_measurementdata
WHERE
$__timeFilter(QueryTime) AND
MeasurinPoint = ‘mp' /* MeasurinPoint like '__searchFilter’ */
GROUP BY time
ORDER BY time