+++
title = 'Improving InfluxDB Sensor Data Queries'
date = 2018-08-07T18:28:00-06:00
+++

I now understand why Grafana built the initial query with `GROUP BY
time($__interval)`. With a hard-coded value in `time()`, every single point is
displayed on the graph, regardless of the zoom level. The `$__interval`
variable scales this value based on the time period displayed.

Initially, this did not work for me, and Grafana just drew seemingly random
points when using any view besides "last 6 hours." This turned out to be
because the default value for "min time interval" was not set (or was
incorrect). Seting it to "10s" (which is the collectd poll interval) corrected
this issue as well.
