-- 수집통계 1단계: 일자 범위 인덱스 (타입 변경 없음)
-- database.py _migrate_feed_collect_stats_indexes() 와 동일
-- 420万+ 행이면 5~30분 · 장외 권장 · INPLACE LOCK=NONE

USE kis_quant_db;

ALTER TABLE ws_ticks
  ADD INDEX idx_ws_ticks_tick_time (tick_time),
  ADD INDEX idx_ws_ticks_day_src (tick_time, source),
  ADD INDEX idx_ws_ticks_src_code_recv (source, code, recv_ts),
  ALGORITHM=INPLACE, LOCK=NONE;

ALTER TABLE ws_orderbook
  ADD INDEX idx_ws_ob_snap (snap_time),
  ADD INDEX idx_ws_ob_snap_src (snap_time, source),
  ALGORITHM=INPLACE, LOCK=NONE;

ALTER TABLE ws_ticks_us
  ADD INDEX idx_ws_ticks_us_tick_time (tick_time),
  ALGORITHM=INPLACE, LOCK=NONE;

ALTER TABLE ls_ws_orderbook
  ADD INDEX idx_ls_ob_snap (snap_time),
  ALGORITHM=INPLACE, LOCK=NONE;
