speedup zalozka planning
Some checks failed
CI and deploy / migration-check (push) Failing after 12s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-05-21 10:37:32 +02:00
parent eb425a26f2
commit d984716f69
10 changed files with 248 additions and 74 deletions

View File

@@ -185,6 +185,9 @@ BEGIN
learning_exclude_reason = EXCLUDED.learning_exclude_reason;
GET DIAGNOSTICS v_count = ROW_COUNT;
perform ems.fn_refresh_site_pv_delta_profile_cache(p_site_id);
RETURN v_count;
END;
$$;
@@ -194,6 +197,7 @@ COMMENT ON FUNCTION ems.fn_fill_forecast_accuracy(INT, INT) IS
learning_eligible / learning_exclude_reason: před delta_learn_min_ts (kalibrace site) se nepočítá do učení delty;
po pv_curtailment_policy_effective_from sloty s curtailment / gen cutoff / cutoff_switch_log (export off) mají NULL actual a jsou vyloučeny z učení;
telemetrie: is_export_limited nebo pv_derating_flags <> 0 v okně slotu → stejné vyloučení (telemetry_derating).
Po úspěšném INSERT volá fn_refresh_site_pv_delta_profile_cache (V079 cache pro /plan/current).
Volat každých 15 minut (spolu s audit_filler) pro inkrementální plnění.
p_lookback_hours: kolik hodin zpět zpracovat (default 48h pro catch-up).
Pro první backfill: SELECT ems.fn_fill_forecast_accuracy(2, 8760) -- 1 rok';