Files
ai-exchange/migrations/004_create_candles_partitions_and_indexes.sql
2026-04-24 13:39:01 +08:00

14 lines
513 B
SQL

create table if not exists candles_2026_04
partition of candles
for values from ('2026-04-01 00:00:00+00') to ('2026-05-01 00:00:00+00');
create table if not exists candles_2026_05
partition of candles
for values from ('2026-05-01 00:00:00+00') to ('2026-06-01 00:00:00+00');
create index if not exists idx_candles_instrument_tf_open_desc
on candles (instrument_id, timeframe, ts_open desc);
create index if not exists idx_candles_instrument_tf_close_desc
on candles (instrument_id, timeframe, ts_close desc);