zrychleni pv forecast per day
Some checks failed
CI and deploy / migration-check (push) Failing after 10s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-27 18:27:27 +02:00
parent cc674900cc
commit 16fc6a065e
3 changed files with 42 additions and 12 deletions

View File

@@ -0,0 +1,18 @@
-- =============================================================
-- V066__latest_telemetry_distinct_on_indexes.sql
-- Zrychlení view ems.vw_latest_* (PostgREST dashboard endpoints).
--
-- View používají DISTINCT ON (...) s ORDER BY ... measured_at desc.
-- Bez odpovídajících indexů může plán spadnout na scan+sort nad
-- velkými Timescale hypertabulkami (sekundy latency).
-- =============================================================
create index if not exists idx_telemetry_inverter_site_inverter_time_desc
on ems.telemetry_inverter (site_id, inverter_id, measured_at desc);
create index if not exists idx_telemetry_ev_site_charger_connector_time_desc
on ems.telemetry_ev_charger (site_id, charger_id, connector_id, measured_at desc);
create index if not exists idx_telemetry_hp_site_heat_pump_time_desc
on ems.telemetry_heat_pump (site_id, heat_pump_id, measured_at desc);