@@ -1983,7 +1983,6 @@ compute_cpu_sort_cost(PlannerInfo *root, List *pathkeys, int nPresortedKeys,
1983
1983
double totalFuncCost = 1.0 ;
1984
1984
bool has_fake_var = false;
1985
1985
int i = 0 ;
1986
- Oid prev_datatype = InvalidOid ;
1987
1986
List * cache_varinfos = NIL ;
1988
1987
1989
1988
/* fallback if pathkeys is unknown */
@@ -2011,50 +2010,17 @@ compute_cpu_sort_cost(PlannerInfo *root, List *pathkeys, int nPresortedKeys,
2011
2010
*/
2012
2011
foreach (lc ,pathkeys )
2013
2012
{
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 ;
2019
2017
2020
2018
/*
2021
2019
* We believe that equivalence members aren't very different, so, to
2022
2020
* estimate cost we consider just the first member.
2023
2021
*/
2024
2022
em = (EquivalenceMember * )linitial (pathkey -> pk_eclass -> ec_members );
2025
2023
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
-
2058
2024
/* remember if we have found a fake Var in pathkeys */
2059
2025
has_fake_var |=is_fake_var (em -> em_expr );
2060
2026
pathkeyExprs = lappend (pathkeyExprs ,em -> em_expr );