I’ve got a SQL table which holds values for each minute. So that is fine for a detailed view within a small time range. But if I choose a big time range (for a year, by example), the amount of data leads into long processing times and sometimes to SQL errors like “Sort aborted” which leads into Grafana is displaying “No data”.
So I pimped my sql queries to retrieve only the n-th rows to reduce the amount of data.
This works pretty cool and pushed up the speediness alot, especially if I select big time ranges. But for small time ranges, the amount of retrieved data by the SQL query would be too poor.
How can I deal with different SQL queries for different time ranges?