diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-02-15 20:49:31 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-02-15 20:49:31 +0000 |
commit | b1577a7c78d2d8880b3c0f94689fb75bd074c897 (patch) | |
tree | c8d8f0500eb2eaa085d921a46a7d0987ba594a4a /src/backend/nodes/equalfuncs.c | |
parent | 553b5da6a1147881dc1df101ecf9bab75f767ccf (diff) |
New cost model for planning, incorporating a penalty for random page
accesses versus sequential accesses, a (very crude) estimate of the
effects of caching on random page accesses, and cost to evaluate WHERE-
clause expressions. Export critical parameters for this model as SET
variables. Also, create SET variables for the planner's enable flags
(enable_seqscan, enable_indexscan, etc) so that these can be controlled
more conveniently than via PGOPTIONS.
Planner now estimates both startup cost (cost before retrieving
first tuple) and total cost of each path, so it can optimize queries
with LIMIT on a reasonable basis by interpolating between these costs.
Same facility is a win for EXISTS(...) subqueries and some other cases.
Redesign pathkey representation to achieve a major speedup in planning
(I saw as much as 5X on a 10-way join); also minor changes in planner
to reduce memory consumption by recycling discarded Path nodes and
not constructing unnecessary lists.
Minor cleanups to display more-plausible costs in some cases in
EXPLAIN output.
Initdb forced by change in interface to index cost estimation
functions.
Diffstat (limited to 'src/backend/nodes/equalfuncs.c')
-rw-r--r-- | src/backend/nodes/equalfuncs.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 3ddc8d6c98a..fadc282d1ad 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.60 2000/02/15 03:37:08 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.61 2000/02/15 20:49:09 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -100,10 +100,10 @@ _equalAttr(Attr *a, Attr *b) { if (!strcmp(a->relname, b->relname)) return false; - if (length(a->attrs) != length(b->attrs)) + if (!equal(a->attrs, b->attrs)) return false; - return equal(a->attrs, b->attrs); + return true; } static bool @@ -342,8 +342,8 @@ _equalPath(Path *a, Path *b) return false; if (!equal(a->parent, b->parent)) return false; - /* do not check path_cost, since it may not be set yet, and being - * a float there are roundoff error issues anyway... + /* do not check path costs, since they may not be set yet, and being + * float values there are roundoff error issues anyway... */ if (!equal(a->pathkeys, b->pathkeys)) return false; @@ -359,6 +359,8 @@ _equalIndexPath(IndexPath *a, IndexPath *b) return false; if (!equal(a->indexqual, b->indexqual)) return false; + if (a->indexscandir != b->indexscandir) + return false; if (!equali(a->joinrelids, b->joinrelids)) return false; return true; @@ -625,8 +627,9 @@ _equalQuery(Query *a, Query *b) /* * We do not check the internal-to-the-planner fields: base_rel_list, - * join_rel_list, query_pathkeys. They might not be set yet, and - * in any case they should be derivable from the other fields. + * join_rel_list, equi_key_list, query_pathkeys. + * They might not be set yet, and in any case they should be derivable + * from the other fields. */ return true; } @@ -644,16 +647,8 @@ _equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b) if (a->relname != b->relname) return false; } - if (a->ref && b->ref) - { - if (! equal(a->ref, b->ref)) - return false; - } - else - { - if (a->ref != b->ref) - return false; - } + if (!equal(a->ref, b->ref)) + return false; if (a->relid != b->relid) return false; if (a->inh != b->inh) @@ -784,6 +779,9 @@ equal(void *a, void *b) case T_Stream: retval = _equalStream(a, b); break; + case T_Attr: + retval = _equalAttr(a, b); + break; case T_Var: retval = _equalVar(a, b); break; @@ -856,9 +854,6 @@ equal(void *a, void *b) case T_EState: retval = _equalEState(a, b); break; - case T_Attr: - retval = _equalAttr(a, b); - break; case T_Integer: case T_String: case T_Float: |