diff options
author | Neil Conway <neilc@samurai.com> | 2004-05-26 04:41:50 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-05-26 04:41:50 +0000 |
commit | d0b4399d81f39decccb23fa38f772b71b51bf96a (patch) | |
tree | 71d3b737f5d93f6c3984412a4910b5810156c5ca /src/backend/optimizer/path/costsize.c | |
parent | 18d0d105635fbc7e476063e662b449f296953a04 (diff) | |
download | postgresql-d0b4399d81f39decccb23fa38f772b71b51bf96a.tar.gz postgresql-d0b4399d81f39decccb23fa38f772b71b51bf96a.zip |
Reimplement the linked list data structure used throughout the backend.
In the past, we used a 'Lispy' linked list implementation: a "list" was
merely a pointer to the head node of the list. The problem with that
design is that it makes lappend() and length() linear time. This patch
fixes that problem (and others) by maintaining a count of the list
length and a pointer to the tail node along with each head node pointer.
A "list" is now a pointer to a structure containing some meta-data
about the list; the head and tail pointers in that structure refer
to ListCell structures that maintain the actual linked list of nodes.
The function names of the list API have also been changed to, I hope,
be more logically consistent. By default, the old function names are
still available; they will be disabled-by-default once the rest of
the tree has been updated to use the new API names.
Diffstat (limited to 'src/backend/optimizer/path/costsize.c')
-rw-r--r-- | src/backend/optimizer/path/costsize.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 94ce4446fa2..71b879b134a 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -49,7 +49,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.126 2004/04/06 18:46:03 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.127 2004/05/26 04:41:21 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -920,7 +920,7 @@ cost_mergejoin(MergePath *path, Query *root) */ if (mergeclauses) { - firstclause = (RestrictInfo *) lfirst(mergeclauses); + firstclause = (RestrictInfo *) linitial(mergeclauses); if (firstclause->left_mergescansel < 0) /* not computed yet? */ mergejoinscansel(root, (Node *) firstclause->clause, &firstclause->left_mergescansel, @@ -1069,7 +1069,7 @@ cost_hashjoin(HashPath *path, Query *root) int numbatches; Selectivity innerbucketsize; Selectivity joininfactor; - List *hcl; + ListCell *hcl; if (!enable_hashjoin) startup_cost += disable_cost; @@ -1267,7 +1267,7 @@ cost_hashjoin(HashPath *path, Query *root) void cost_qual_eval(QualCost *cost, List *quals) { - List *l; + ListCell *l; cost->startup = 0; cost->per_tuple = 0; @@ -1444,7 +1444,7 @@ static Selectivity approx_selectivity(Query *root, List *quals, JoinType jointype) { Selectivity total = 1.0; - List *l; + ListCell *l; foreach(l, quals) { @@ -1699,7 +1699,7 @@ static void set_rel_width(Query *root, RelOptInfo *rel) { int32 tuple_width = 0; - List *tllist; + ListCell *tllist; foreach(tllist, FastListValue(&rel->reltargetlist)) { |