Refreshing variable daily

Hello, I have been wondering if there is a way for grafana to store variable for X amount of time before refreshing it?

Currently one of my variables is updating by running a query on a database, but the slowest I can update it by setting it to ‘on dashboard load’, and that is not ideal since the value rarely changes and if the dashboard is loaded 100 times a day it puts unnecessary strain on the database.

Is there an easier way to handle this problem rather than making another database which will store result or said query just to load from it instead? Because this method is just offloading the strain somewhere else, and not actually reducing unnecessary load.

1 Like

Welcome

What kind of database is it?

I’m not sure how to answer this question correctly, it’s a complex system. It’s Microsoft SQL server. The point is that for example I’m querying sys.databases to get a list of environments, so that’s one variable so I can switch between each environment. Each of these environments has a table with certain game ID’s, and I want to use that table to limit down search results from another table, or select multiple game ID’s at the same time so I can graph out how the games perform.

As you can imagine the games list does not change that often so querying it 200 times a day every time someone is monitoring these graphs is undesirable, and causes unnecessary delay when opening dashboards until that information is loaded.

1 Like

gotcha.

Are you using OSS or enterprise?

enterprise has a caching feature

poor man option would be generating a csv or json file on the grafana server (better as it would be local) or public folder grafana has access to and read from that via csv/json plugin.
This file would be updated once a day or using a table trigger. poor man’s (moonshine) solution