-
Notifications
You must be signed in to change notification settings - Fork 9
Grafana: Improve SQL template to use DATE_BIN() (CrateDB 5.7+) #1508
Copy link
Copy link
Open
Description
Summary
In the Grafana end-to-end example (application/grafana/example-weather.py), the SQL query template currently uses $__timeGroupAlias("timestamp", $__interval) together with MEAN() for time-series aggregation.
It has been recommended to adopt the modern DATE_BIN() function (available since CrateDB 5.7) as the preferred SQL template for Grafana queries, since CrateDB 5.7 is already a reasonably old baseline.
Using the correct querying scheme and template is critical — as noted by @hammerhead — to avoid overloading the cluster or setting the wire and the browser on fire when processing large datasets. This is important knowledge that is not always applied correctly by users and customers.
Background
- @matriv flagged the
DATE_BIN()function (recommended by @seut) as the modern replacement in this comment. - The original discussion about the querying scheme can be found here.
- @zolbatar has volunteered to look into the details of the new
DATE_BIN()variant.
Tasks
- Validate the
DATE_BIN()SQL template for Grafana with CrateDB (coordinated with @zolbatar) - Update the SQL query in
application/grafana/example-weather.pyto use the modernDATE_BIN()approach - Add the legacy
$__timeGroupAliasSQL template to the documentation as a reference for users on older CrateDB versions
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels