# Using mssql as datasource, Do I need to query the whole time interval (7days) to update a graph?

**URL:** <https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528>\
**Category:** General\
**Created:** [May 21, 2019, 11:21pm UTC](https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528 "2019-05-21T23:21:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brunofl](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@brunofl](https://community.grafana.com/u/brunofl)\
**Post date:** [May 21, 2019, 11:21pm UTC](https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528/1 "2019-05-21T23:21:31Z")

</div>

I basically want to know if is there a best practice to keep a timeseries graph updated getting initial data from a general query and then using a query to update just newer datapoints?

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [May 22, 2019, 12:13am UTC](https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528/2 "2019-05-22T00:13:43Z")

</div>

What refresh interval will you use?

---

<div class="post-metadata">

**Author:** ![brunofl](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@brunofl](https://community.grafana.com/u/brunofl)\
**Post date:** [May 22, 2019, 8:34am UTC](https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528/3 "2019-05-22T08:34:19Z")

</div>

I am testing with 30 min

---

<div class="post-metadata">

**Author:** ![anon34853223](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon34853223](https://community.grafana.com/u/anon34853223)\
**Post date:** [May 22, 2019, 8:37am UTC](https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528/4 "2019-05-22T08:37:10Z")

</div>

Grafana will always fetch all data. Maybe something that will be supported in the future.

---

<div class="post-metadata">

**Author:** ![danielgonzalez](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/danielgonzalez/32/7125_2.png) [@danielgonzalez](https://community.grafana.com/u/danielgonzalez)\
**Post date:** [May 23, 2019, 12:41am UTC](https://community.grafana.com/t/using-mssql-as-datasource-do-i-need-to-query-the-whole-time-interval-7days-to-update-a-graph/17528/5 "2019-05-23T00:41:21Z")

</div>

My recommendation is to use the characteristics of grafana,  
for example the variable `$__interval`, which allows you to bring the appropriate data according to the rendering, then you can make a group by and get avg of data.  
You must also use the `$__timeFilter` macro. but above all never bring data that you do not need, better to create several dashboards, and in case of having an event, or need more detail, go to dashboards that present these details.  
it may not be good to update the dashboard constantly if your app is not in “real time”
