我在不使用索引的键上有一个大型表连接。
在这里查询和计划: https://explain.dalibo.com/plan/15a6a91492g8g935#plan/node/5
两个表在键上都有一个索引,如下所示:
CREATE UNIQUE INDEX "stage_fact_revenue_900_idx_a" ON "stage"."stage_fact_revenue_900_add_dims" USING BTREE ("date","billed_relation_id","subject_client_id","identifier","revenue_type");
CREATE UNIQUE INDEX "fact_revenue_idx_a" ON "star"."fact_revenue" USING BTREE ("date","identifier","billed_relation_id","subject_client_id","revenue_type");
但未使用索引(请参阅查询计划)。
有任何线索说明为什么这种情况没有发生吗?最大的步骤是排序,我可以对表进行预排序来防止这种情况发生吗?