freedakgmail
|
122290e3b0
|
perf: Phase 12 — 物化剩余9个慢函数,全量API优化完成
新增物化视图:
- mv_store_action_priority_deep_monthly (10.7s→3ms)
- mv_inventory_cost_classified_monthly (37ms→3ms, 消除重复调用)
- mv_dish_pair_summary_monthly (171s→3ms)
- mv_store_area_efficiency_monthly (10.1s→3ms)
- mv_store_site_profile_monthly (9.3s→3ms)
- mv_site_segment_benchmark_monthly (12s→3ms)
- mv_store_site_replication_monthly (12.6s→3ms)
- mv_store_overlap_risk_monthly (88s→3ms)
- mv_district_site_benchmark_monthly (56s→3ms)
后端: 所有 fn_ 函数调用替换为物化视图查询
前端: BossPage 添加 MonthPicker 组件并传递 month 参数
修复: cost/category-benchmark 排序列名 store_code→sales_store_code
总计: 21个物化视图, 全部API响应<1.7秒
|
2026-08-01 14:51:24 +08:00 |
|
freedakgmail
|
25db0f3854
|
perf: 全量物化视图优化 — 按月预计算所有慢函数,API响应从106秒降至0.09秒
- 创建12个按月物化视图替代实时函数调用
- phase10: mv_dish_sku_summary_monthly, mv_dish_sku_abc_monthly
- phase11: mv_store_risk_rating/platform_economics/category_mix/member_opportunity/benchmark_composite/deep_diagnosis/dish_basket/dish_store_summary/theoretical_actual_cost (全部_monthly)
- 后端所有路由从 fn_xxx() 改为 mv_xxx_monthly WHERE month_start =
- 新增 analytics.refresh_all_monthly_views() 刷新函数
- 优化 fn_dish_sku_summary: CTE物化避免重复调用
- 优化 fn_dish_sku_abc: CTE物化 fn_dish_sku_summary 只调用一次
- 优化 fn_dish_sales: 添加 dish_name IS NOT NULL 提前过滤
|
2026-08-01 14:05:12 +08:00 |
|