mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
Building the coarse buckets from the DAY tier read every day of the window into the process: a five-year yearly read moved thousands of rows per type, and the Coach's history bands read several such windows per request. The per-day source pick and the fold now run in Postgres (DISTINCT ON the day, ordered by the ladder rank and then the source name, the same order the in-process pick uses), so a coarse read returns one row per bucket. The long-range chart picks its tier from the span of the window's days and reads that tier once. The Coach snapshot hands its already-loaded source order to the history bands instead of each band reading it again.