mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
v1.4.35 left the regression intact: comprehensive-aggregator and the slim summaries slice still ran the full COUNT/MIN/MAX/AVG `$queryRaw` in parallel with the rollup read, only preferring the bucket-derived values when the count happened to match. Net round-trip count saved was zero on Marc's 311k-row account. Promote the rollup table to the canonical source on the happy path: gate on a cheap `SELECT COUNT(*) FROM measurement_rollups` and, when non-zero, drop the heavy aggregate. The bucket composition feeds count/min/max/mean, a narrow `$queryRaw` keeps the non-composable windowed columns (stddev/anomalies/avg7/avg30/avg30_last_month + the three slope tuples), and the legacy heavy aggregate stays as the cold-mount fallback for accounts whose backfill is mid-flight. Unit tests pin the contract: the heavy aggregate is NOT called on the rollup-fresh branch. Integration test verifies byte-identical count / min / max / mean against a parallel live SQL pass on a populated fixture.