Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3303ea1

Browse files
committed
Remove reltarget_has_non_vars flag.
Commitb12fd41 added a "reltarget_has_non_vars" field to RelOptInfo,but failed to maintain it accurately. Since its only purpose was to skipcalls to has_parallel_hazard() in the simple case where a rel's targetlistis all Vars, and that call is really pretty cheap in that case anyway, itseems like this is just a case of premature optimization. Let's drop theflag and do the calls unconditionally until it's proven that we need moresmarts here.
1 parent2f153dd commit3303ea1

File tree

5 files changed

+4
-15
lines changed

5 files changed

+4
-15
lines changed

‎src/backend/nodes/outfuncs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,6 @@ _outRelOptInfo(StringInfo str, const RelOptInfo *node)
20832083
WRITE_BOOL_FIELD(consider_param_startup);
20842084
WRITE_BOOL_FIELD(consider_parallel);
20852085
WRITE_NODE_FIELD(reltarget);
2086-
WRITE_BOOL_FIELD(reltarget_has_non_vars);
20872086
WRITE_NODE_FIELD(pathlist);
20882087
WRITE_NODE_FIELD(ppilist);
20892088
WRITE_NODE_FIELD(partial_pathlist);

‎src/backend/optimizer/path/allpaths.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,12 +613,10 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
613613
return;
614614

615615
/*
616-
* If the relation's outputs are not parallel-safe, we must give up. In
617-
* the common case where the relation only outputs Vars, this check is
618-
* very cheap; otherwise, we have to do more work.
616+
* Likewise, if the relation's outputs are not parallel-safe, give up.
617+
* (Usually, they're just Vars, but sometimes they're not.)
619618
*/
620-
if (rel->reltarget_has_non_vars&&
621-
has_parallel_hazard((Node*)rel->reltarget->exprs, false))
619+
if (has_parallel_hazard((Node*)rel->reltarget->exprs, false))
622620
return;
623621

624622
/* We have a winner. */
@@ -984,7 +982,6 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
984982
adjust_appendrel_attrs(root,
985983
(Node*)rel->reltarget->exprs,
986984
appinfo);
987-
childrel->reltarget_has_non_vars=rel->reltarget_has_non_vars;
988985

989986
/*
990987
* We have to make child entries in the EquivalenceClass data

‎src/backend/optimizer/util/placeholder.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ add_placeholders_to_base_rels(PlannerInfo *root)
393393

394394
rel->reltarget->exprs=lappend(rel->reltarget->exprs,
395395
copyObject(phinfo->ph_var));
396-
rel->reltarget_has_non_vars= true;
397396
/* reltarget's cost and width fields will be updated later */
398397
}
399398
}
@@ -428,7 +427,6 @@ add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel,
428427
/* Yup, add it to the output */
429428
joinrel->reltarget->exprs=lappend(joinrel->reltarget->exprs,
430429
phinfo->ph_var);
431-
joinrel->reltarget_has_non_vars= true;
432430
joinrel->reltarget->width+=phinfo->ph_width;
433431

434432
/*

‎src/backend/optimizer/util/relnode.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
109109
rel->consider_parallel= false;/* might get changed later */
110110
rel->rel_parallel_workers=-1;/* set up in GetRelationInfo */
111111
rel->reltarget=create_empty_pathtarget();
112-
rel->reltarget_has_non_vars= false;
113112
rel->pathlist=NIL;
114113
rel->ppilist=NIL;
115114
rel->partial_pathlist=NIL;
@@ -397,7 +396,6 @@ build_join_rel(PlannerInfo *root,
397396
joinrel->consider_param_startup= false;
398397
joinrel->consider_parallel= false;
399398
joinrel->reltarget=create_empty_pathtarget();
400-
joinrel->reltarget_has_non_vars= false;
401399
joinrel->pathlist=NIL;
402400
joinrel->ppilist=NIL;
403401
joinrel->partial_pathlist=NIL;
@@ -520,8 +518,7 @@ build_join_rel(PlannerInfo *root,
520518
*/
521519
if (inner_rel->consider_parallel&&outer_rel->consider_parallel&&
522520
!has_parallel_hazard((Node*)restrictlist, false)&&
523-
!(joinrel->reltarget_has_non_vars&&
524-
has_parallel_hazard((Node*)joinrel->reltarget->exprs, false)))
521+
!has_parallel_hazard((Node*)joinrel->reltarget->exprs, false))
525522
joinrel->consider_parallel= true;
526523

527524
/*

‎src/include/nodes/relation.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,6 @@ typedef struct RelOptInfo
490490

491491
/* default result targetlist for Paths scanning this relation */
492492
structPathTarget*reltarget;/* list of Vars/Exprs, cost, width */
493-
boolreltarget_has_non_vars;/* true if any expression in
494-
* PathTarget is a non-Var */
495493

496494
/* materialization information */
497495
List*pathlist;/* Path structures */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp