mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Remove the last traces of Joe Hellerstein's "xfunc" optimization. Patch
from Alvaro Herrera. Also, removed lispsort.c, since it is no longer used.
This commit is contained in:
parent
a3015829ee
commit
1812d3b233
@ -4,7 +4,7 @@
|
|||||||
# Makefile for lib (miscellaneous stuff)
|
# Makefile for lib (miscellaneous stuff)
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $PostgreSQL: pgsql/src/backend/lib/Makefile,v 1.18 2003/11/29 19:51:49 pgsql Exp $
|
# $PostgreSQL: pgsql/src/backend/lib/Makefile,v 1.19 2004/04/25 18:23:56 neilc Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ subdir = src/backend/lib
|
|||||||
top_builddir = ../../..
|
top_builddir = ../../..
|
||||||
include $(top_builddir)/src/Makefile.global
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
OBJS = dllist.o lispsort.o stringinfo.o
|
OBJS = dllist.o stringinfo.o
|
||||||
|
|
||||||
all: SUBSYS.o
|
all: SUBSYS.o
|
||||||
|
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
/*-------------------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* lispsort.c
|
|
||||||
*
|
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* IDENTIFICATION
|
|
||||||
* $PostgreSQL: pgsql/src/backend/lib/lispsort.c,v 1.20 2003/11/29 19:51:49 pgsql Exp $
|
|
||||||
*
|
|
||||||
*-------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "postgres.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef NOT_USED
|
|
||||||
/*
|
|
||||||
** lisp_qsort: Takes a lisp list as input, copies it into an array of lisp
|
|
||||||
** nodes which it sorts via qsort() with the comparison function
|
|
||||||
** as passed into lisp_qsort(), and returns a new list with
|
|
||||||
** the nodes sorted. The old list is *not* freed or modified (?)
|
|
||||||
*/
|
|
||||||
List *
|
|
||||||
lisp_qsort(List *the_list, /* the list to be sorted */
|
|
||||||
int (*compare) ()) /* function to compare two nodes */
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
size_t num;
|
|
||||||
List **nodearray;
|
|
||||||
List *tmp,
|
|
||||||
*output;
|
|
||||||
|
|
||||||
/* find size of list */
|
|
||||||
num = length(the_list);
|
|
||||||
if (num < 2)
|
|
||||||
return copyObject(the_list);
|
|
||||||
|
|
||||||
/* copy elements of the list into an array */
|
|
||||||
nodearray = (List **) palloc(num * sizeof(List *));
|
|
||||||
|
|
||||||
for (tmp = the_list, i = 0; tmp != NIL; tmp = lnext(tmp), i++)
|
|
||||||
nodearray[i] = copyObject(lfirst(tmp));
|
|
||||||
|
|
||||||
/* sort the array */
|
|
||||||
pg_qsort(nodearray, num, sizeof(List *), compare);
|
|
||||||
|
|
||||||
/* lcons together the array elements */
|
|
||||||
output = NIL;
|
|
||||||
for (i = num - 1; i >= 0; i--)
|
|
||||||
output = lcons(nodearray[i], output);
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.112 2004/01/14 23:01:55 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.113 2004/04/25 18:23:56 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -531,16 +531,6 @@ make_one_rel_by_joins(Query *root, int levels_needed, List *initial_rels)
|
|||||||
{
|
{
|
||||||
rel = (RelOptInfo *) lfirst(x);
|
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 */
|
/* Find and save the cheapest paths for this rel */
|
||||||
set_cheapest(rel);
|
set_cheapest(rel);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.168 2004/02/29 17:36:05 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.169 2004/04/25 18:23:56 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -167,19 +167,6 @@ create_plan(Query *root, Path *best_path)
|
|||||||
break;
|
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;
|
return plan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.103 2004/03/29 19:58:04 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.104 2004/04/25 18:23:56 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -243,9 +243,9 @@ set_cheapest(RelOptInfo *parent_rel)
|
|||||||
* A path is worthy if it has either a better sort order (better pathkeys)
|
* 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.
|
* 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
|
* We also remove from the rel's pathlist any old paths that are dominated
|
||||||
* pathlist any old paths that are dominated by new_path --- that is,
|
* by new_path --- that is, new_path is both cheaper and at least as well
|
||||||
* new_path is both cheaper and at least as well ordered.
|
* ordered.
|
||||||
*
|
*
|
||||||
* The pathlist is kept sorted by TOTAL_COST metric, with cheaper paths
|
* 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
|
* at the front. No code depends on that for correctness; it's simply
|
||||||
@ -342,10 +342,9 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove current element from pathlist if dominated by new,
|
* Remove current element from pathlist if dominated by new.
|
||||||
* unless xfunc told us not to remove any paths.
|
|
||||||
*/
|
*/
|
||||||
if (remove_old && parent_rel->pruneable)
|
if (remove_old)
|
||||||
{
|
{
|
||||||
List *p1_next = lnext(p1);
|
List *p1_next = lnext(p1);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.55 2004/02/17 00:52:53 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.56 2004/04/25 18:23:56 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -135,7 +135,6 @@ make_base_rel(Query *root, int relid)
|
|||||||
rel->cheapest_startup_path = NULL;
|
rel->cheapest_startup_path = NULL;
|
||||||
rel->cheapest_total_path = NULL;
|
rel->cheapest_total_path = NULL;
|
||||||
rel->cheapest_unique_path = NULL;
|
rel->cheapest_unique_path = NULL;
|
||||||
rel->pruneable = true;
|
|
||||||
rel->relid = relid;
|
rel->relid = relid;
|
||||||
rel->rtekind = rte->rtekind;
|
rel->rtekind = rte->rtekind;
|
||||||
/* min_attr, max_attr, attr_needed, attr_widths are set below */
|
/* min_attr, max_attr, attr_needed, attr_widths are set below */
|
||||||
@ -291,7 +290,6 @@ build_join_rel(Query *root,
|
|||||||
joinrel->cheapest_startup_path = NULL;
|
joinrel->cheapest_startup_path = NULL;
|
||||||
joinrel->cheapest_total_path = NULL;
|
joinrel->cheapest_total_path = NULL;
|
||||||
joinrel->cheapest_unique_path = NULL;
|
joinrel->cheapest_unique_path = NULL;
|
||||||
joinrel->pruneable = true;
|
|
||||||
joinrel->relid = 0; /* indicates not a baserel */
|
joinrel->relid = 0; /* indicates not a baserel */
|
||||||
joinrel->rtekind = RTE_JOIN;
|
joinrel->rtekind = RTE_JOIN;
|
||||||
joinrel->min_attr = 0;
|
joinrel->min_attr = 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.400 2004/04/19 17:42:58 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.401 2004/04/25 18:23:56 neilc Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -89,11 +89,6 @@ bool Log_disconnections = false;
|
|||||||
|
|
||||||
LogStmtLevel log_statement = LOGSTMT_NONE;
|
LogStmtLevel log_statement = LOGSTMT_NONE;
|
||||||
|
|
||||||
/*
|
|
||||||
* Flags for expensive function optimization -- JMH 3/9/92
|
|
||||||
*/
|
|
||||||
int XfuncMode = 0;
|
|
||||||
|
|
||||||
/* GUC variable for maximum stack depth (measured in kilobytes) */
|
/* GUC variable for maximum stack depth (measured in kilobytes) */
|
||||||
int max_stack_depth = 2048;
|
int max_stack_depth = 2048;
|
||||||
|
|
||||||
@ -2223,7 +2218,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
|||||||
ctx = debug_context = PGC_POSTMASTER;
|
ctx = debug_context = PGC_POSTMASTER;
|
||||||
gucsource = PGC_S_ARGV; /* initial switches came from command line */
|
gucsource = PGC_S_ARGV; /* initial switches came from command line */
|
||||||
|
|
||||||
while ((flag = getopt(argc, argv, "A:B:c:D:d:Eef:FiNOPo:p:S:st:v:W:x:-:")) != -1)
|
while ((flag = getopt(argc, argv, "A:B:c:D:d:Eef:FiNOPo:p:S:st:v:W:-:")) != -1)
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -2459,39 +2454,6 @@ PostgresMain(int argc, char *argv[], const char *username)
|
|||||||
pg_usleep(atoi(optarg)*1000000L);
|
pg_usleep(atoi(optarg)*1000000L);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x':
|
|
||||||
#ifdef NOT_USED /* planner/xfunc.h */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* control joey hellerstein's expensive function
|
|
||||||
* optimization
|
|
||||||
*/
|
|
||||||
if (XfuncMode != 0)
|
|
||||||
{
|
|
||||||
elog(WARNING, "only one -x flag is allowed");
|
|
||||||
errs++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (strcmp(optarg, "off") == 0)
|
|
||||||
XfuncMode = XFUNC_OFF;
|
|
||||||
else if (strcmp(optarg, "nor") == 0)
|
|
||||||
XfuncMode = XFUNC_NOR;
|
|
||||||
else if (strcmp(optarg, "nopull") == 0)
|
|
||||||
XfuncMode = XFUNC_NOPULL;
|
|
||||||
else if (strcmp(optarg, "nopm") == 0)
|
|
||||||
XfuncMode = XFUNC_NOPM;
|
|
||||||
else if (strcmp(optarg, "pullall") == 0)
|
|
||||||
XfuncMode = XFUNC_PULLALL;
|
|
||||||
else if (strcmp(optarg, "wait") == 0)
|
|
||||||
XfuncMode = XFUNC_WAIT;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elog(WARNING, "use -x {off,nor,nopull,nopm,pullall,wait}");
|
|
||||||
errs++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
case '-':
|
case '-':
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.93 2004/01/05 23:39:54 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.94 2004/04/25 18:23:57 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -99,8 +99,6 @@ typedef struct QualCost
|
|||||||
* (regardless of its ordering)
|
* (regardless of its ordering)
|
||||||
* cheapest_unique_path - for caching cheapest path to produce unique
|
* cheapest_unique_path - for caching cheapest path to produce unique
|
||||||
* (no duplicates) output from relation
|
* (no duplicates) output from relation
|
||||||
* pruneable - flag to let the planner know whether it can prune the
|
|
||||||
* pathlist of this RelOptInfo or not.
|
|
||||||
*
|
*
|
||||||
* If the relation is a base relation it will have these fields set:
|
* If the relation is a base relation it will have these fields set:
|
||||||
*
|
*
|
||||||
@ -193,7 +191,6 @@ typedef struct RelOptInfo
|
|||||||
struct Path *cheapest_startup_path;
|
struct Path *cheapest_startup_path;
|
||||||
struct Path *cheapest_total_path;
|
struct Path *cheapest_total_path;
|
||||||
struct Path *cheapest_unique_path;
|
struct Path *cheapest_unique_path;
|
||||||
bool pruneable;
|
|
||||||
|
|
||||||
/* information about a base rel (not set for join rels!) */
|
/* information about a base rel (not set for join rels!) */
|
||||||
Index relid;
|
Index relid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user