Noticed today, if the SCADA table is missing data points, the whole graph is missing the data points.
This comes from a required optimisation to explicitly date range the SCADA table lookup for performance.
Specifically this line
|
AND settlementdate_inner >= DATE_TRUNC('hour', NOW() - CAST(:interval AS Interval) + INTERVAL '5 min') |
Removing this line solves the problem, but the query takes about 30x longer since it scans the entire SCADA table.