docs+chore(projects): 索引 EXPLAIN 分析 + 修正过时注释
- BizOrgMapper: selectSponsorOrgOptions/selectExecutorOrgOptions 注释 写 "走 idx_org_user_type_name", EXPLAIN 实际命中 idx_org_type_status (优化器小数据下选小索引), 改为实测索引 + Using where 描述 - manager_projects.md §9.3: biz_project_assign 唯一约束状态标 ✅ (SHOW INDEX 实测有 uk_project_unit, doc 老版本误标 ❌) - manager_projects.md §9.5: 新增索引分析章节, 记录 8 个关键查询 EXPLAIN 命中 + 已加/评估后未加的索引决策 DB 实际改动 (已落库, 无 .sql 文件): - ADD INDEX idx_assign_exec_user_project (exec_user_id, project_id) on biz_project_assign — 服务机机构 EXISTS+IN covering 优化 - DROP 临时测试的 idx_org_type_id — 优化器未采纳, 33 行数据量不值
This commit is contained in:
@@ -104,7 +104,8 @@
|
||||
<!--
|
||||
支持方下拉选项: JOIN sys_user 取主账号 user_name (供分配弹窗缓存 biz_project.sponsor_admin_user_name 用)
|
||||
返回 Map: userId / orgName / userName
|
||||
走 idx_org_user_type_name 索引 (user_id, org_type, org_name)
|
||||
EXPLAIN 实际命中: idx_org_type_status (org_type,status) (优化器在数据量小时倾向小索引),
|
||||
org_name LIKE 走 Using where 二次过滤, ORDER BY org_id DESC 走 filesort
|
||||
过滤条件: orgName 模糊匹配 (主用) / userId 精确匹配 (拉回已选项)
|
||||
-->
|
||||
<select id="selectSponsorOrgOptions" parameterType="BizOrg" resultType="java.util.LinkedHashMap">
|
||||
@@ -124,7 +125,8 @@
|
||||
<!--
|
||||
执行方下拉选项: JOIN sys_user 取 MAIN 账号 user_name (parent_user_id IS NULL 限定主账号)
|
||||
返回 Map: userId / orgName / userName
|
||||
走 idx_org_user_type_name 索引 (user_id, org_type, org_name)
|
||||
EXPLAIN 实际命中: idx_org_type_status (org_type,status) (优化器在数据量小时倾向小索引),
|
||||
sys_user 走 PRIMARY eq_ref, parent_user_id IS NULL 走 Using where
|
||||
关键: 只查 MAIN 账号 (parent_user_id IS NULL), 过滤掉同一公司下的普通员工子账号
|
||||
value=userId (MAIN 账号 sys_user.user_id, 直接写 biz_project_assign.exec_user_id)
|
||||
label=orgName (执行单位名称, 不带 user_name 避免人名/昵称混淆)
|
||||
|
||||
Reference in New Issue
Block a user