x
This commit is contained in:
@@ -73,8 +73,34 @@ SELECT create_hypertable(
|
||||
-- ============================================================
|
||||
-- Kompresní politiky pro staré chunky
|
||||
-- Telemetrie starší 30 dní komprimovat (čtení stačí)
|
||||
-- Nutné nejdřív zapnout kompresi na hypertable (TimescaleDB 2.x+ / Tiger Data),
|
||||
-- jinak add_compression_policy hlásí chybu o columnstore / compression.
|
||||
-- ============================================================
|
||||
|
||||
ALTER TABLE ems.telemetry_inverter SET (
|
||||
timescaledb.compress,
|
||||
timescaledb.compress_orderby = 'measured_at DESC',
|
||||
timescaledb.compress_segmentby = 'site_id, inverter_id'
|
||||
);
|
||||
|
||||
ALTER TABLE ems.telemetry_ev_charger SET (
|
||||
timescaledb.compress,
|
||||
timescaledb.compress_orderby = 'measured_at DESC',
|
||||
timescaledb.compress_segmentby = 'site_id, charger_id, connector_id'
|
||||
);
|
||||
|
||||
ALTER TABLE ems.telemetry_heat_pump SET (
|
||||
timescaledb.compress,
|
||||
timescaledb.compress_orderby = 'measured_at DESC',
|
||||
timescaledb.compress_segmentby = 'site_id, heat_pump_id'
|
||||
);
|
||||
|
||||
ALTER TABLE ems.market_interval_price SET (
|
||||
timescaledb.compress,
|
||||
timescaledb.compress_orderby = 'interval_start DESC',
|
||||
timescaledb.compress_segmentby = 'market_source'
|
||||
);
|
||||
|
||||
SELECT add_compression_policy('ems.telemetry_inverter', INTERVAL '30 days', if_not_exists => TRUE);
|
||||
SELECT add_compression_policy('ems.telemetry_ev_charger', INTERVAL '30 days', if_not_exists => TRUE);
|
||||
SELECT add_compression_policy('ems.telemetry_heat_pump', INTERVAL '30 days', if_not_exists => TRUE);
|
||||
|
||||
Reference in New Issue
Block a user