Skip to content

Commit 98369eb

Browse files
committed
remove step
1 parent 306b239 commit 98369eb

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

src/backend/optimizer/path/costsize.c

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,6 @@ compute_cpu_sort_cost(PlannerInfo *root, List *pathkeys, int nPresortedKeys,
19831983
double totalFuncCost = 1.0;
19841984
bool has_fake_var = false;
19851985
int i = 0;
1986-
Oid prev_datatype = InvalidOid;
19871986
List *cache_varinfos = NIL;
19881987

19891988
/* fallback if pathkeys is unknown */
@@ -2011,50 +2010,17 @@ compute_cpu_sort_cost(PlannerInfo *root, List *pathkeys, int nPresortedKeys,
20112010
*/
20122011
foreach(lc, pathkeys)
20132012
{
2014-
PathKey *pathkey = (PathKey *) lfirst(lc);
2015-
EquivalenceMember *em;
2016-
double nGroups,
2017-
correctedNGroups;
2018-
Cost funcCost = 1.0;
2013+
PathKey *pathkey = (PathKey *) lfirst(lc);
2014+
EquivalenceMember *em;
2015+
double nGroups,
2016+
correctedNGroups;
20192017

20202018
/*
20212019
* We believe that equivalence members aren't very different, so, to
20222020
* estimate cost we consider just the first member.
20232021
*/
20242022
em = (EquivalenceMember *) linitial(pathkey->pk_eclass->ec_members);
20252023

2026-
if (em->em_datatype != InvalidOid)
2027-
{
2028-
/* do not lookup funcCost if the data type is the same */
2029-
if (prev_datatype != em->em_datatype)
2030-
{
2031-
Oid sortop;
2032-
QualCost cost;
2033-
2034-
sortop = get_opfamily_member(pathkey->pk_opfamily,
2035-
em->em_datatype, em->em_datatype,
2036-
pathkey->pk_strategy);
2037-
2038-
cost.startup = 0;
2039-
cost.per_tuple = 0;
2040-
add_function_cost(root, get_opcode(sortop), NULL, &cost);
2041-
2042-
/*
2043-
* add_function_cost returns the product of cpu_operator_cost
2044-
* and procost, but we need just procost, co undo that.
2045-
*/
2046-
funcCost = cost.per_tuple / cpu_operator_cost;
2047-
2048-
prev_datatype = em->em_datatype;
2049-
}
2050-
}
2051-
2052-
/* factor in the width of the values in this column */
2053-
funcCost *= get_width_cost_multiplier(root, em->em_expr);
2054-
2055-
/* now we have per-key cost, so add to the running total */
2056-
totalFuncCost += funcCost;
2057-
20582024
/* remember if we have found a fake Var in pathkeys */
20592025
has_fake_var |= is_fake_var(em->em_expr);
20602026
pathkeyExprs = lappend(pathkeyExprs, em->em_expr);

0 commit comments

Comments
 (0)