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/geqo/geqo_eval.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/geqo/geqo_eval.c')
-rw-r--r-- | src/backend/optimizer/geqo/geqo_eval.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c index ccb095aad03..1642f34b408 100644 --- a/src/backend/optimizer/geqo/geqo_eval.c +++ b/src/backend/optimizer/geqo/geqo_eval.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.67 2004/01/23 23:54:21 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.68 2004/05/26 04:41:20 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -238,14 +238,14 @@ static bool desirable_join(Query *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel) { - List *i; + ListCell *l; /* * Join if there is an applicable join clause. */ - foreach(i, outer_rel->joininfo) + foreach(l, outer_rel->joininfo) { - JoinInfo *joininfo = (JoinInfo *) lfirst(i); + JoinInfo *joininfo = (JoinInfo *) lfirst(l); if (bms_is_subset(joininfo->unjoined_relids, inner_rel->relids)) return true; @@ -256,9 +256,9 @@ desirable_join(Query *root, * needed to improve the odds that we will find a valid solution in * a case where an IN sub-select has a clauseless join. */ - foreach(i, root->in_info_list) + foreach(l, root->in_info_list) { - InClauseInfo *ininfo = (InClauseInfo *) lfirst(i); + InClauseInfo *ininfo = (InClauseInfo *) lfirst(l); if (bms_is_subset(outer_rel->relids, ininfo->righthand) && bms_is_subset(inner_rel->relids, ininfo->righthand)) |