prop/docs
Graham McIntire 5ec66df135
Cut propagation_scores write cost with DELETE+COPY, skip-factors, UNLOGGED
The scoring+upsert phase was ~4m40s per forecast hour and dominated
wall time. Three stacked optimizations attack it from different
angles.

replace_scores/2 is a new hot-path writer that does DELETE WHERE
valid_time = $1 followed by a plain insert_all (no ON CONFLICT
resolution). The chain worker rewrites the full (valid_time, all
bands) slice every forecast hour, so conflict detection was pure
waste. AsosAdjustmentWorker still uses upsert_scores because it
only rewrites the subset of cells near a station.

factors is now nullable. Forecast hours f01-f18 pass factors: nil
so the JSONB encode + toast write is skipped entirely — roughly
halves the data volume per run. point_detail/4 coalesces nil to
an empty map so the JS popup renders without a TypeError, and
scorer_diff only pulls the most recent valid_time that still has
factors (the f00 row).

propagation_scores is now UNLOGGED, so inserts bypass WAL entirely.
Durability tradeoff: an unclean shutdown truncates the table, but
PropagationGridWorker rebuilds it from HRRR every 3h so a lost
table is re-populated within one cron cycle.

Also adds docs/plans/2026-04-14-duckdb-scores-storage.md — a
speculative plan for a flat-file / DuckDB rewrite with explicit
trigger conditions for when to pick it up (partitioning deferred
too; revisit only if these three don't solve it).
2026-04-14 13:47:35 -05:00
..
algo-reports Refresh 2026-04-13 recalibration report 2026-04-13 12:29:51 -05:00
plans Cut propagation_scores write cost with DELETE+COPY, skip-factors, UNLOGGED 2026-04-14 13:47:35 -05:00
research Phase 3 spike (parked) + Phase 6: temperature anomaly 2026-04-10 08:47:11 -05:00
algo_commercial.md Refactor HRRR fetch to batch points per hour 2026-03-30 17:21:47 -05:00
algo_original.md Refactor HRRR fetch to batch points per hour 2026-03-30 17:21:47 -05:00
algo_updated_with_data.md Refactor HRRR fetch to batch points per hour 2026-03-30 17:21:47 -05:00
analysis_output.txt Normalize ML features to prevent NaN gradient explosion 2026-04-01 09:08:33 -05:00
analysis_output_solar.txt Normalize ML features to prevent NaN gradient explosion 2026-04-01 09:08:33 -05:00
findings10.md Correct Finding 10: Great Lakes firing squad explains 24G PH anomaly 2026-04-01 11:07:58 -05:00
goes-r-research.md HRRR forecast hours (f00-f18) with timeline map UI 2026-03-31 16:44:47 -05:00
RRFS.md Add meteorologist feedback on model choice to RRFS doc 2026-03-31 09:27:23 -05:00