Skip to content

Commit c4516c9

Browse files
committed
pathman: cleanup
1 parent af36a64 commit c4516c9

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

contrib/pg_pathman/pg_pathman.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static void set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
9797
Index rti, RangeTblEntry *rte);
9898
static void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte);
9999
static List *accumulate_append_subpath(List *subpaths, Path *path);
100-
static void set_pathkeys(PlannerInfo *root, RelOptInfo *childrel, Path *path);
101100
static void generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
102101
List *live_childrels,
103102
List *all_child_pathkeys);
@@ -482,7 +481,6 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
482481
foreach(lc, root->eq_classes)
483482
{
484483
EquivalenceClass *cur_ec = (EquivalenceClass *) lfirst(lc);
485-
ListCell *lc2;
486484

487485
if (list_length(cur_ec->ec_members) > 1)
488486
{
@@ -521,22 +519,19 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
521519
double parent_rows = 0;
522520
double parent_size = 0;
523521
ListCell *l;
524-
int i;
525522

526523
foreach(l, root->append_rel_list)
527524
{
528525
AppendRelInfo *appinfo = (AppendRelInfo *) lfirst(l);
529526
int childRTindex,
530527
parentRTindex = rti;
531-
RangeTblEntry *childRTE;
532528
RelOptInfo *childrel;
533529

534530
/* append_rel_list contains all append rels; ignore others */
535531
if (appinfo->parent_relid != parentRTindex)
536532
continue;
537533

538534
childRTindex = appinfo->child_relid;
539-
childRTE = root->simple_rte_array[childRTindex];
540535

541536
childrel = find_base_rel(root, childRTindex);
542537
Assert(childrel->reloptkind == RELOPT_OTHER_MEMBER_REL);
@@ -639,12 +634,12 @@ append_child_relation(PlannerInfo *root, RelOptInfo *rel, Index rti,
639634
root->append_rel_list = lappend(root->append_rel_list, appinfo);
640635
root->total_table_pages += (double) childrel->pages;
641636

642-
/* Add to equivalence members */
637+
/* Add equivalence members */
643638
foreach(lc, root->eq_classes)
644639
{
645640
EquivalenceClass *cur_ec = (EquivalenceClass *) lfirst(lc);
646-
ListCell *lc2;
647641

642+
/* Copy equivalence member from parent and make some modifications */
648643
if (list_length(cur_ec->ec_members) > 0)
649644
{
650645
EquivalenceMember *cur_em = (EquivalenceMember *) linitial(cur_ec->ec_members);
@@ -665,6 +660,9 @@ append_child_relation(PlannerInfo *root, RelOptInfo *rel, Index rti,
665660
rel->relids = bms_add_member(rel->relids, childRTindex);
666661
root->all_baserels = bms_add_member(root->all_baserels, childRTindex);
667662

663+
/* Recalc parent relation tuples count */
664+
rel->tuples += childrel->tuples;
665+
668666
heap_close(newrelation, NoLock);
669667
}
670668

@@ -1507,19 +1505,6 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
15071505
all_child_pathkeys);
15081506
}
15091507

1510-
void
1511-
set_pathkeys(PlannerInfo *root, RelOptInfo *childrel, Path *path)
1512-
{
1513-
ListCell *lc;
1514-
PathKey *pathkey;
1515-
1516-
foreach (lc, root->sort_pathkeys)
1517-
{
1518-
pathkey = (PathKey *) lfirst(lc);
1519-
path->pathkeys = lappend(path->pathkeys, pathkey);
1520-
}
1521-
}
1522-
15231508
static List *
15241509
accumulate_append_subpath(List *subpaths, Path *path)
15251510
{

0 commit comments

Comments
 (0)