-> Seq Scan on p2_c3_c2
(23 rows)
+-- This hint doesn't turn on parallel, so the Parallel hint is ignored
+show max_parallel_workers_per_gather;
+ max_parallel_workers_per_gather
+---------------------------------
+ 0
+(1 row)
+
/*+Parallel(p1 0 hard) IndexScan(p1) */
EXPLAIN (COSTS false) SELECT * FROM p1 join p2 on p1.id = p2.id;
LOG: pg_hint_plan:
used hint:
IndexScan(p1)
-Parallel(p1 0 hard)
not used hint:
+Parallel(p1 0 hard)
duplication hint:
error hint:
rel = root->simple_rel_array[relid];
/*
- * This function is called for any RelOptInfo or its inheritance parent if
- * any. If we are called from inheritance planner, the RelOptInfo for the
- * parent of target child relation is not set in the planner info.
- *
- * Otherwise we should check that the reloptinfo is base relation or
- * inheritance children.
+ * Parallel planning is appliable only on base relation, which has
+ * RelOptInfo.
*/
- if (rel &&
- rel->reloptkind != RELOPT_BASEREL &&
- rel->reloptkind != RELOPT_OTHER_MEMBER_REL)
+ if (!rel)
+ return NULL;
+
+ /*
+ * We have set root->glob->parallelModeOK if needed. What we should do here
+ * is just following the decision of planner.
+ */
+ if (!rel->consider_parallel)
return NULL;
/*
rte = root->simple_rte_array[relid];
Assert(rte);
- /* We don't hint on other than relation and foreign tables */
- if (rte->rtekind != RTE_RELATION ||
- rte->relkind == RELKIND_FOREIGN_TABLE)
- return NULL;
-
/* Find parallel method hint, which matches given names, from the list. */
for (i = 0; i < current_hint_state->num_hints[HINT_TYPE_PARALLEL]; i++)
{
-- we don't have parallel over index scans so far
/*+Parallel(p1 8 hard) IndexScan(p1) */
EXPLAIN (COSTS false) SELECT * FROM p1 join p2 on p1.id = p2.id;
+
+-- This hint doesn't turn on parallel, so the Parallel hint is ignored
+show max_parallel_workers_per_gather;
/*+Parallel(p1 0 hard) IndexScan(p1) */
EXPLAIN (COSTS false) SELECT * FROM p1 join p2 on p1.id = p2.id;