Hackers,
While playing with the init code I noticed traces of Hellerstein's
expensive function optimization. It is completely disabled, uses
functions nowhere to be defined, and is out of date. So I removed it.
Here is the patch. Note that it takes out the pruneable field from
struct RelOptInfo, since it's not used.
Tom Lane has said a couple of times that he thinks this maybe can be
resurrected; but even if it is, most likely it won't use this code
(what code? These are only hooks.)
(To the patcher: the file src/backend/lib/lispsort.c can also be removed
after this change)
--
Alvaro Herrera (alvherre[a]dcc.uchile.cl)
Hoy es el primer día del resto de mi vida
Index: src/backend/optimizer/path/allpaths.c
===
RCS file: /home/alvherre/cvs/pgsql-server/src/backend/optimizer/path/allpaths.c,v
retrieving revision 1.112
diff -c -r1.112 allpaths.c
*** src/backend/optimizer/path/allpaths.c 14 Jan 2004 23:01:55 - 1.112
--- src/backend/optimizer/path/allpaths.c 24 Apr 2004 01:53:10 -
***
*** 531,546
{
rel = (RelOptInfo *) lfirst(x);
- #ifdef NOT_USED
-
- /*
-* * for each expensive predicate in each path in each
-* distinct rel, * consider doing pullup -- JMH
-*/
- if (XfuncMode != XFUNC_NOPULL XfuncMode != XFUNC_OFF)
- xfunc_trypullup(rel);
- #endif
-
/* Find and save the cheapest paths for this rel */
set_cheapest(rel);
--- 531,536
Index: src/backend/optimizer/plan/createplan.c
===
RCS file: /home/alvherre/cvs/pgsql-server/src/backend/optimizer/plan/createplan.c,v
retrieving revision 1.168
diff -c -r1.168 createplan.c
*** src/backend/optimizer/plan/createplan.c 29 Feb 2004 17:36:05 - 1.168
--- src/backend/optimizer/plan/createplan.c 24 Apr 2004 01:29:14 -
***
*** 167,185
break;
}
- #ifdef NOT_USED /* fix xfunc */
- /* sort clauses by cost/(1-selectivity) -- JMH 2/26/92 */
- if (XfuncMode != XFUNC_OFF)
- {
- set_qpqual((Plan) plan,
- lisp_qsort(get_qpqual((Plan) plan),
- xfunc_clause_compare));
- if (XfuncMode != XFUNC_NOR)
- /* sort the disjuncts within each clause by cost -- JMH 3/4/92
*/
- xfunc_disjunct_sort(plan-qpqual);
- }
- #endif
-
return plan;
}
--- 167,172
Index: src/backend/optimizer/util/pathnode.c
===
RCS file: /home/alvherre/cvs/pgsql-server/src/backend/optimizer/util/pathnode.c,v
retrieving revision 1.103
diff -c -r1.103 pathnode.c
*** src/backend/optimizer/util/pathnode.c 29 Mar 2004 19:58:04 - 1.103
--- src/backend/optimizer/util/pathnode.c 24 Apr 2004 01:39:45 -
***
*** 243,251
* A path is worthy if it has either a better sort order (better pathkeys)
* or cheaper cost (on either dimension) than any of the existing old paths.
*
! * Unless parent_rel-pruneable is false, we also remove from the rel's
! * pathlist any old paths that are dominated by new_path --- that is,
! * new_path is both cheaper and at least as well ordered.
*
* The pathlist is kept sorted by TOTAL_COST metric, with cheaper paths
* at the front. No code depends on that for correctness; it's simply
--- 243,251
* A path is worthy if it has either a better sort order (better pathkeys)
* or cheaper cost (on either dimension) than any of the existing old paths.
*
! * We also remove from the rel's pathlist any old paths that are dominated
! * by new_path --- that is, new_path is both cheaper and at least as well
! * ordered.
*
* The pathlist is kept sorted by TOTAL_COST metric, with cheaper paths
* at the front. No code depends on that for correctness; it's simply
***
*** 342,351
}
/*
!* Remove current element from pathlist if dominated by new,
!* unless xfunc told us not to remove any paths.
*/
! if (remove_old parent_rel-pruneable)
{
List *p1_next = lnext(p1);
--- 342,350
}
/*
!* Remove current element from pathlist if dominated by new.
*/
! if (remove_old)
{
List *p1_next = lnext(p1);