Skip to content

Commit 14661ba

Browse files
committed
Replace has_multiple_baserels() with a bitmap test on all_baserels.
Since we added the PlannerInfo.all_baserels set, it's not really necessary to grovel over the rangetable to count baserels in the current query. So let's drop has_multiple_baserels() in favor of a bms_membership() test. This might be microscopically faster, but the main point is to remove some unnecessary code. Richard Guo Discussion: https://postgr.es/m/CAMbWs4_8RcSbbfs1ASZLrMuL0c0EQgXWcoLTQD8swBRY_pQQiA@mail.gmail.com
1 parent 98e8974 commit 14661ba

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/backend/optimizer/path/allpaths.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,28 +2190,6 @@ set_dummy_rel_pathlist(RelOptInfo *rel)
21902190
set_cheapest(rel);
21912191
}
21922192

2193-
/* quick-and-dirty test to see if any joining is needed */
2194-
static bool
2195-
has_multiple_baserels(PlannerInfo *root)
2196-
{
2197-
int num_base_rels = 0;
2198-
Index rti;
2199-
2200-
for (rti = 1; rti < root->simple_rel_array_size; rti++)
2201-
{
2202-
RelOptInfo *brel = root->simple_rel_array[rti];
2203-
2204-
if (brel == NULL)
2205-
continue;
2206-
2207-
/* ignore RTEs that are "other rels" */
2208-
if (brel->reloptkind == RELOPT_BASEREL)
2209-
if (++num_base_rels > 1)
2210-
return true;
2211-
}
2212-
return false;
2213-
}
2214-
22152193
/*
22162194
* find_window_run_conditions
22172195
* Determine if 'wfunc' is really a WindowFunc and call its prosupport
@@ -2661,7 +2639,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
26612639
root->hasHavingQual ||
26622640
parse->distinctClause ||
26632641
parse->sortClause ||
2664-
has_multiple_baserels(root))
2642+
bms_membership(root->all_baserels) == BMS_MULTIPLE)
26652643
tuple_fraction = 0.0; /* default case */
26662644
else
26672645
tuple_fraction = root->tuple_fraction;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy