Files
ems/db/migration/V070__forecast_accuracy_delta_profile_index.sql
Dusan Vojacek e35110cb87
Some checks failed
CI and deploy / migration-check (push) Failing after 11s
CI and deploy / deploy (push) Has been skipped
speedup srovnani
2026-04-27 20:09:40 +02:00

17 lines
705 B
SQL

-- Zrychlení fn_pv_forecast_delta_profile (volá ho pv-slots-corrected): range scan site + interval_start
-- s podmínkami učení bez sekvenčního full scanu větší historie.
create index if not exists idx_forecast_accuracy_site_interval_delta_profile
on ems.forecast_accuracy (
site_id,
interval_start desc,
pv_array_id,
forecast_created_at desc
)
where actual_power_w is not null
and coalesce(learning_eligible, true) = true
and forecast_created_at <= interval_start;
comment on index ems.idx_forecast_accuracy_site_interval_delta_profile is
'Partial index pro výběr posledního forecast runu na slot (DISTINCT ON interval_start, pv_array_id) v delta profilu.';