-- ============================================================ -- 09_add_indexes.sql -- 门店详情页性能优化索引 -- ============================================================ -- bill_fact 表:门店+日期复合索引(日度趋势、概览等查询使用) CREATE INDEX IF NOT EXISTS idx_bill_fact_store_closed ON analytics.bill_fact (store_code, closed_at); -- bill_fact 物化视图:单独的 store_code 索引(其他视图按 store_code 过滤时使用) CREATE INDEX IF NOT EXISTS idx_bill_fact_store ON analytics.bill_fact (store_code);