We have an application where we have data being stored in a MySQL database at fixed intervals, lets say every “x” seconds. The user sets a time frame (lets say one hour), and the automatic refresh is set to every 5 seconds or so.
Using the Graph panel, when you first load a Grafana page with a time frame of say one hour, there is a bit of a pause while the data is queried, handled, and displayed on the screen. This all seems perfectly reasonable to me.
From that point on, is there a way to make it so that the Graph Panel sends a different query, which only grabs data that has been inserted since the initial query? Basically, I’d like to graph a FIFO data set, and avoid re-querying all of the data each refresh.
The sequence would go something like this:
1.) Page loads, SQL query requests values within the selected time range
2.) MySQL returns the data set, Grafana processes it and the graph is drawn on the page (this step may take some time)
3.) Once the Refresh timer is triggered, Grafana sends a new SQL query that selects from the END time of the last query until Now.
4.) For each row returned by the query, add it to the end of the graphed data and remove the oldest value. (This is the FIFO part)
5.) Update the graph to reflect the new data set (hopefully without having to re-process everything?)
6.) Repeat steps 3 through 5
This seems like it would be a significant performance improvement, I am just not sure the functionality exists already? If it doesnt, is anybody interested in helping us develop it short term?