Commit
b12fd41c6 added a "reltarget_has_non_vars" field to RelOptInfo,
but failed to maintain it accurately. Since its only purpose was to skip
calls to has_parallel_hazard() in the simple case where a rel's targetlist
is all Vars, and that call is really pretty cheap in that case anyway, it
seems like this is just a case of premature optimization. Let's drop the
flag and do the calls unconditionally until it's proven that we need more
smarts here.
WRITE_BOOL_FIELD(consider_param_startup);
WRITE_BOOL_FIELD(consider_parallel);
WRITE_NODE_FIELD(reltarget);
- WRITE_BOOL_FIELD(reltarget_has_non_vars);
WRITE_NODE_FIELD(pathlist);
WRITE_NODE_FIELD(ppilist);
WRITE_NODE_FIELD(partial_pathlist);
return;
/*
- * If the relation's outputs are not parallel-safe, we must give up. In
- * the common case where the relation only outputs Vars, this check is
- * very cheap; otherwise, we have to do more work.
+ * Likewise, if the relation's outputs are not parallel-safe, give up.
+ * (Usually, they're just Vars, but sometimes they're not.)
*/
- if (rel->reltarget_has_non_vars &&
- has_parallel_hazard((Node *) rel->reltarget->exprs, false))
+ if (has_parallel_hazard((Node *) rel->reltarget->exprs, false))
return;
/* We have a winner. */
adjust_appendrel_attrs(root,
(Node *) rel->reltarget->exprs,
appinfo);
- childrel->reltarget_has_non_vars = rel->reltarget_has_non_vars;
/*
* We have to make child entries in the EquivalenceClass data
rel->reltarget->exprs = lappend(rel->reltarget->exprs,
copyObject(phinfo->ph_var));
- rel->reltarget_has_non_vars = true;
/* reltarget's cost and width fields will be updated later */
}
}
/* Yup, add it to the output */
joinrel->reltarget->exprs = lappend(joinrel->reltarget->exprs,
phinfo->ph_var);
- joinrel->reltarget_has_non_vars = true;
joinrel->reltarget->width += phinfo->ph_width;
/*
rel->consider_parallel = false; /* might get changed later */
rel->rel_parallel_workers = -1; /* set up in GetRelationInfo */
rel->reltarget = create_empty_pathtarget();
- rel->reltarget_has_non_vars = false;
rel->pathlist = NIL;
rel->ppilist = NIL;
rel->partial_pathlist = NIL;
joinrel->consider_param_startup = false;
joinrel->consider_parallel = false;
joinrel->reltarget = create_empty_pathtarget();
- joinrel->reltarget_has_non_vars = false;
joinrel->pathlist = NIL;
joinrel->ppilist = NIL;
joinrel->partial_pathlist = NIL;
*/
if (inner_rel->consider_parallel && outer_rel->consider_parallel &&
!has_parallel_hazard((Node *) restrictlist, false) &&
- !(joinrel->reltarget_has_non_vars &&
- has_parallel_hazard((Node *) joinrel->reltarget->exprs, false)))
+ !has_parallel_hazard((Node *) joinrel->reltarget->exprs, false))
joinrel->consider_parallel = true;
/*
/* default result targetlist for Paths scanning this relation */
struct PathTarget *reltarget; /* list of Vars/Exprs, cost, width */
- bool reltarget_has_non_vars; /* true if any expression in
- * PathTarget is a non-Var */
/* materialization information */
List *pathlist; /* Path structures */