prop/test/microwaveprop/propagation
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
..
asos_nudge_test.exs Fix BackfillEnqueueWorker test timeouts and credo length warnings 2026-04-12 15:02:48 -05:00
band_config_test.exs Refresh propagation algo against expanded prod corpus (2026-04-13) 2026-04-13 10:59:01 -05:00
duct_test.exs Phase 4: Ray-traced duct geometry 2026-04-10 08:31:16 -05:00
grid_score_test.exs Cut propagation_scores write cost with DELETE+COPY, skip-factors, UNLOGGED 2026-04-14 13:47:35 -05:00
grid_test.exs Increase grid to 0.125 degrees with smooth canvas overlay 2026-03-31 08:52:07 -05:00
inversion_test.exs Phase 2 tasks 2.1-2.4: BL turbulence feature computations 2026-04-10 08:21:23 -05:00
model_test.exs Integrate ML model into grid worker, QSO search, and UI improvements 2026-04-01 10:14:22 -05:00
pipeline_status_test.exs Fix ERA5 cap math + stuck threshold, split chip label onto two lines 2026-04-14 12:06:39 -05:00
recalibrator_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
region_test.exs Phase 7: Regionalized seasonal scoring 2026-04-10 08:39:01 -05:00
score_cache_test.exs Nudge HRRR scores with live ASOS obs between runs 2026-04-12 14:27:27 -05:00
scorer_diff_test.exs Phase 9.3, 9.4, and Phase 3 NEXRAD pipeline 2026-04-10 12:48:36 -05:00
scorer_test.exs Wire NEXRAD, native ducts, and commercial links into scoring 2026-04-13 12:08:15 -05:00