Do not prefetch if the join's locus is bottleneck.
There is no risk for motion deadlock when the join's
gang contains only one process. For such scenario, we
do not prefetch anything just behave like Postgres.
@@ -998,6 +998,16 @@ create_join_plan(PlannerInfo *root, JoinPath *best_path)
best_path->outerjoinpath->motionHazard)
((Join *) plan)->prefetch_joinqual = true;
+ /* CDB: if the join's locus is bottleneck which means the
+ * join gang only contain on process, so there is no
+ * risk for motion deadlock.
+ */
+ if (CdbPathLocus_IsBottleneck(best_path->path.locus))
+ {
+ ((Join *) plan)->prefetch_inner = false;
+ ((Join *) plan)->prefetch_joinqual = false;
+ }
+
/*
* If there are any pseudoconstant clauses attached to this node, insert a
* gating Result node that evaluates the pseudoconstants as one-time
