diff options
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 18849183182..8d1b374bdf0 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -3368,28 +3368,11 @@ double estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows, List **pgset, EstimationInfo *estinfo) { - return estimate_num_groups_incremental(root, groupExprs, - input_rows, pgset, estinfo, - NULL, 0); -} - -/* - * estimate_num_groups_incremental - * An estimate_num_groups variant, optimized for cases that are adding the - * expressions incrementally (e.g. one by one). - */ -double -estimate_num_groups_incremental(PlannerInfo *root, List *groupExprs, - double input_rows, - List **pgset, EstimationInfo *estinfo, - List **cache_varinfos, int prevNExprs) -{ - List *varinfos = (cache_varinfos) ? *cache_varinfos : NIL; + List *varinfos = NIL; double srf_multiplier = 1.0; double numdistinct; ListCell *l; - int i, - j; + int i; /* Zero the estinfo output parameter, if non-NULL */ if (estinfo != NULL) @@ -3420,7 +3403,7 @@ estimate_num_groups_incremental(PlannerInfo *root, List *groupExprs, */ numdistinct = 1.0; - i = j = 0; + i = 0; foreach(l, groupExprs) { Node *groupexpr = (Node *) lfirst(l); @@ -3429,14 +3412,6 @@ estimate_num_groups_incremental(PlannerInfo *root, List *groupExprs, List *varshere; ListCell *l2; - /* was done on previous call */ - if (cache_varinfos && j++ < prevNExprs) - { - if (pgset) - i++; /* to keep in sync with lines below */ - continue; - } - /* is expression in this grouping set? */ if (pgset && !list_member_int(*pgset, i++)) continue; @@ -3506,11 +3481,7 @@ estimate_num_groups_incremental(PlannerInfo *root, List *groupExprs, if (varshere == NIL) { if (contain_volatile_functions(groupexpr)) - { - if (cache_varinfos) - *cache_varinfos = varinfos; return input_rows; - } continue; } @@ -3527,9 +3498,6 @@ estimate_num_groups_incremental(PlannerInfo *root, List *groupExprs, } } - if (cache_varinfos) - *cache_varinfos = varinfos; - /* * If now no Vars, we must have an all-constant or all-boolean GROUP BY * list. |