liufumingren b7feed7e76 perf(order): 补复核时间统计索引,消除大屏复核数全表扫描
大屏「今日复核数」(warehouse_panel.queryFulfillment)固定按 recheck_time 区间 + status 过滤 + dispatch_lane IN ('m4','m5') 做 count,而 dispatch 分表上 recheck_time 无任何索引:EXPLAIN 为 type=ALL / rows=1,400,782,生产 7 天出现 138 次、平均 35.8s(同形状的 delivery_time 版本命中 idx_dispatch_1000028_panel_fulfillment 走 range,可直接对比)。

索引形态:current/outsourced 为 (recheck_time,status);dispatch 为 (recheck_time,status,dispatch_lane),比 current 版本多带 dispatch_lane 以便 count(*) 完全走索引不回表,并由 isPanelRecheckIndexName 保证 dispatch 不继承 current 版本。历史表不参与大屏统计,不建该索引。

依据:抽样 20 万行 recheck_time 非空 97.9%、status<>cancel 98.8%,时间窗口是唯一有效过滤条件。索引仍由模型定义在分表首次访问时懒创建。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-17 01:47:26 +08:00
..
2026-04-17 19:21:57 +08:00
2026-04-17 19:21:57 +08:00
1
2026-05-16 02:44:53 +08:00