Commit f6af85da by luoqi

fix(db): account for correlated host and tenant in fact queries

parent 9cef8091
Pipeline #3720 failed in 0 seconds
-- 宿主和租户高度相关;独立选择率相乘会严重低估小宿主的事实量。
-- 测试库 2093 万行中,Friday 的两列选择率各约 1.78%。未声明依赖时,
-- 单患者详情误走 patient_id 与 host/tenant/status 的 BitmapAnd,实测约 48 秒。
-- 联合统计让优化器正确估算宿主范围,选择患者索引;保留所有租户隔离条件。
-- ⛔ 不通过禁用 bitmapscan 或移除 host/tenant 条件绕过问题。
CREATE STATISTICS IF NOT EXISTS patient_facts_host_tenant_dependencies (dependencies)
ON host_id, tenant_id FROM patient_facts;
ANALYZE patient_facts (host_id, tenant_id, patient_id, status);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment