1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-24 10:47:04 +03:00

Rename Rel to RelOptInfo.

This commit is contained in:
Bruce Momjian 1998-07-18 04:22:52 +00:00
parent 3a132e9d83
commit 584f9438ca
38 changed files with 295 additions and 295 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.43 1998/07/15 14:54:31 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.44 1998/07/18 04:22:25 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -998,10 +998,10 @@ _copyArrayRef(ArrayRef *from)
** planner/path/xfunc.c accordingly!!! ** planner/path/xfunc.c accordingly!!!
** -- JMH, 8/2/93 ** -- JMH, 8/2/93
*/ */
static Rel * static RelOptInfo *
_copyRel(Rel *from) _copyRel(RelOptInfo *from)
{ {
Rel *newnode = makeNode(Rel); RelOptInfo *newnode = makeNode(RelOptInfo);
int i, int i,
len; len;
@ -1734,7 +1734,7 @@ copyObject(void *from)
/* /*
* RELATION NODES * RELATION NODES
*/ */
case T_Rel: case T_RelOptInfo:
retval = _copyRel(from); retval = _copyRel(from);
break; break;
case T_Path: case T_Path:

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.40 1998/07/15 14:54:32 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.41 1998/07/18 04:22:26 momjian Exp $
* *
* NOTES * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
@ -990,11 +990,11 @@ _outEState(StringInfo str, EState *node)
* Stuff from relation.h * Stuff from relation.h
*/ */
static void static void
_outRel(StringInfo str, Rel *node) _outRel(StringInfo str, RelOptInfo *node)
{ {
char buf[500]; char buf[500];
appendStringInfo(str, " REL "); appendStringInfo(str, " RELOPTINFO ");
appendStringInfo(str, " :relids "); appendStringInfo(str, " :relids ");
_outIntList(str, node->relids); _outIntList(str, node->relids);
@ -1058,7 +1058,7 @@ _outRel(StringInfo str, Rel *node)
static void static void
_outTargetEntry(StringInfo str, TargetEntry *node) _outTargetEntry(StringInfo str, TargetEntry *node)
{ {
appendStringInfo(str, " TLE "); appendStringInfo(str, " TARGETENTRY ");
appendStringInfo(str, " :resdom "); appendStringInfo(str, " :resdom ");
_outNode(str, node->resdom); _outNode(str, node->resdom);
@ -1787,7 +1787,7 @@ _outNode(StringInfo str, void *obj)
case T_EState: case T_EState:
_outEState(str, obj); _outEState(str, obj);
break; break;
case T_Rel: case T_RelOptInfo:
_outRel(str, obj); _outRel(str, obj);
break; break;
case T_TargetEntry: case T_TargetEntry:

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.32 1998/07/15 14:54:34 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.33 1998/07/18 04:22:26 momjian Exp $
* *
* NOTES * NOTES
* Most of the read functions for plan nodes are tested. (In fact, they * Most of the read functions for plan nodes are tested. (In fact, they
@ -1221,14 +1221,14 @@ _readEState()
* _readRel * _readRel
* ---------------- * ----------------
*/ */
static Rel * static RelOptInfo *
_readRel() _readRel()
{ {
Rel *local_node; RelOptInfo *local_node;
char *token; char *token;
int length; int length;
local_node = makeNode(Rel); local_node = makeNode(RelOptInfo);
token = lsptok(NULL, &length); /* get :relids */ token = lsptok(NULL, &length); /* get :relids */
local_node->relids = local_node->relids =
@ -1990,9 +1990,9 @@ parsePlanString(void)
return_value = _readParam(); return_value = _readParam();
else if (!strncmp(token, "ESTATE", length)) else if (!strncmp(token, "ESTATE", length))
return_value = _readEState(); return_value = _readEState();
else if (!strncmp(token, "REL", length)) else if (!strncmp(token, "RELOPTINFO", length))
return_value = _readRel(); return_value = _readRel();
else if (!strncmp(token, "TLE", length)) else if (!strncmp(token, "TARGETENTRY", length))
return_value = _readTargetEntry(); return_value = _readTargetEntry();
else if (!strncmp(token, "RTE", length)) else if (!strncmp(token, "RTE", length))
return_value = _readRangeTblEntry(); return_value = _readRangeTblEntry();

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo_eval.c,v 1.19 1998/06/15 19:28:35 momjian Exp $ * $Id: geqo_eval.c,v 1.20 1998/07/18 04:22:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -50,13 +50,13 @@
#include "optimizer/geqo_paths.h" #include "optimizer/geqo_paths.h"
static List *gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel); static List *gimme_clause_joins(Query *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel);
static Rel *gimme_clauseless_join(Rel *outer_rel, Rel *inner_rel); static RelOptInfo *gimme_clauseless_join(RelOptInfo *outer_rel, RelOptInfo *inner_rel);
static Rel *init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo); static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo);
static List *new_join_tlist(List *tlist, List *other_relids, int first_resdomno); static List *new_join_tlist(List *tlist, List *other_relids, int first_resdomno);
static List *new_joininfo_list(List *joininfo_list, List *join_relids); static List *new_joininfo_list(List *joininfo_list, List *join_relids);
static void geqo_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel); static void geqo_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel);
static Rel *geqo_nth(int stop, List *rels); static RelOptInfo *geqo_nth(int stop, List *rels);
/* /*
* geqo_eval-- * geqo_eval--
@ -66,7 +66,7 @@ static Rel *geqo_nth(int stop, List *rels);
Cost Cost
geqo_eval(Query *root, Gene *tour, int num_gene) geqo_eval(Query *root, Gene *tour, int num_gene)
{ {
Rel *joinrel; RelOptInfo *joinrel;
Cost fitness; Cost fitness;
List *temp; List *temp;
@ -98,14 +98,14 @@ geqo_eval(Query *root, Gene *tour, int num_gene)
* *
* Returns a new join relation incorporating all joins in a left-sided tree. * Returns a new join relation incorporating all joins in a left-sided tree.
*/ */
Rel * RelOptInfo *
gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel) gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *outer_rel)
{ {
Rel *inner_rel; /* current relation */ RelOptInfo *inner_rel; /* current relation */
int base_rel_index; int base_rel_index;
List *new_rels = NIL; List *new_rels = NIL;
Rel *new_rel = NULL; RelOptInfo *new_rel = NULL;
if (rel_count < num_gene) if (rel_count < num_gene)
{ /* tree not yet finished */ { /* tree not yet finished */
@ -113,7 +113,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
/* tour[0] = 3; tour[1] = 1; tour[2] = 2 */ /* tour[0] = 3; tour[1] = 1; tour[2] = 2 */
base_rel_index = (int) tour[rel_count]; base_rel_index = (int) tour[rel_count];
inner_rel = (Rel *) geqo_nth(base_rel_index, root->base_relation_list_); inner_rel = (RelOptInfo *) geqo_nth(base_rel_index, root->base_relation_list_);
if (rel_count == 0) if (rel_count == 0)
{ /* processing first join with { /* processing first join with
@ -158,7 +158,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
} }
/* get essential new relation */ /* get essential new relation */
new_rel = (Rel *) lfirst(new_rels); new_rel = (RelOptInfo *) lfirst(new_rels);
rel_count++; rel_count++;
/* process new_rel->cheapestpath, new_rel->unorderedpath */ /* process new_rel->cheapestpath, new_rel->unorderedpath */
@ -189,7 +189,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
*/ */
static List * static List *
gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel) gimme_clause_joins(Query *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
{ {
List *join_list = NIL; List *join_list = NIL;
List *i = NIL; List *i = NIL;
@ -198,7 +198,7 @@ gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
foreach(i, joininfo_list) foreach(i, joininfo_list)
{ {
JInfo *joininfo = (JInfo *) lfirst(i); JInfo *joininfo = (JInfo *) lfirst(i);
Rel *rel = NULL; RelOptInfo *rel = NULL;
if (!joininfo->inactive) if (!joininfo->inactive)
{ {
@ -239,8 +239,8 @@ gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
* Returns a new join relation. * Returns a new join relation.
*/ */
static Rel * static RelOptInfo *
gimme_clauseless_join(Rel *outer_rel, Rel *inner_rel) gimme_clauseless_join(RelOptInfo *outer_rel, RelOptInfo *inner_rel)
{ {
return (init_join_rel(outer_rel, inner_rel, (JInfo *) NULL)); return (init_join_rel(outer_rel, inner_rel, (JInfo *) NULL));
} }
@ -256,10 +256,10 @@ gimme_clauseless_join(Rel *outer_rel, Rel *inner_rel)
* *
* Returns the new join relation node. * Returns the new join relation node.
*/ */
static Rel * static RelOptInfo *
init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo) init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
{ {
Rel *joinrel = makeNode(Rel); RelOptInfo *joinrel = makeNode(RelOptInfo);
List *joinrel_joininfo_list = NIL; List *joinrel_joininfo_list = NIL;
List *new_outer_tlist; List *new_outer_tlist;
List *new_inner_tlist; List *new_inner_tlist;
@ -457,7 +457,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
List *xrel = NIL; List *xrel = NIL;
List *xjoininfo = NIL; List *xjoininfo = NIL;
Rel *rel; RelOptInfo *rel;
List *relids; List *relids;
List *super_rels; List *super_rels;
@ -466,7 +466,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xjoinrel, joinrels) foreach(xjoinrel, joinrels)
{ {
Rel *joinrel = (Rel *) lfirst(xjoinrel); RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids) foreach(xrelid, joinrel->relids)
{ {
@ -477,7 +477,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
*/ */
/* /*
* ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); Rel *rel = * ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); RelOptInfo *rel =
* get_join_rel(root, relid); * get_join_rel(root, relid);
*/ */
@ -502,7 +502,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
} }
foreach(xjoinrel, joinrels) foreach(xjoinrel, joinrels)
{ {
Rel *joinrel = (Rel *) lfirst(xjoinrel); RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo) foreach(xjoininfo, joinrel->joininfo)
{ {
@ -516,7 +516,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
{ {
/* /*
* ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); Rel * ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); RelOptInfo
* *rel = get_join_rel(root, relid); * *rel = get_join_rel(root, relid);
*/ */
@ -549,7 +549,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xsuper_rel, super_rels) foreach(xsuper_rel, super_rels)
{ {
Rel *super_rel = (Rel *) lfirst(xsuper_rel); RelOptInfo *super_rel = (RelOptInfo *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel)) if (nonoverlap_rels(super_rel, joinrel))
{ {
@ -584,7 +584,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
} }
foreach(xrel, outerrels) foreach(xrel, outerrels)
{ {
rel = (Rel *) lfirst(xrel); rel = (RelOptInfo *) lfirst(xrel);
rel->superrels = NIL; rel->superrels = NIL;
} }
} }
@ -611,7 +611,7 @@ geqo_final_join_rels(List *join_rel_list)
*/ */
foreach(xrel, join_rel_list) foreach(xrel, join_rel_list)
{ {
Rel *rel = (Rel *) lfirst(xrel); RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
List *xjoininfo = NIL; List *xjoininfo = NIL;
bool final = true; bool final = true;
@ -645,7 +645,7 @@ geqo_final_join_rels(List *join_rel_list)
* Modifies the superrels field of rel * Modifies the superrels field of rel
*/ */
static void static void
add_superrels(Rel *rel, Rel *super_rel) add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
{ {
rel->superrels = lappend(rel->superrels, super_rel); rel->superrels = lappend(rel->superrels, super_rel);
} }
@ -660,7 +660,7 @@ add_superrels(Rel *rel, Rel *super_rel)
* Returns non-nil if rel1 and rel2 do not overlap. * Returns non-nil if rel1 and rel2 do not overlap.
*/ */
static bool static bool
nonoverlap_rels(Rel *rel1, Rel *rel2) nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
{ {
return (nonoverlap_sets(rel1->relids, rel2->relids)); return (nonoverlap_sets(rel1->relids, rel2->relids));
} }
@ -688,7 +688,7 @@ nonoverlap_sets(List *s1, List *s2)
* long join queries; so get logarithm of size when MAXINT overflow; * long join queries; so get logarithm of size when MAXINT overflow;
*/ */
static void static void
geqo_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel) geqo_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
{ {
Cost temp; Cost temp;
int ntuples; int ntuples;
@ -715,7 +715,7 @@ geqo_log(double x, double b)
return (log(x) / log(b)); return (log(x) / log(b));
} }
static Rel * static RelOptInfo *
geqo_nth(int stop, List *rels) geqo_nth(int stop, List *rels)
{ {
List *r; List *r;

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo_main.c,v 1.7 1998/02/26 04:32:22 momjian Exp $ * $Id: geqo_main.c,v 1.8 1998/07/18 04:22:27 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -63,7 +63,7 @@
* similar to a constrained Traveling Salesman Problem (TSP) * similar to a constrained Traveling Salesman Problem (TSP)
*/ */
Rel * RelOptInfo *
geqo(Query *root) geqo(Query *root)
{ {
int generation; int generation;
@ -98,7 +98,7 @@ geqo(Query *root)
status_interval; status_interval;
Gene *best_tour; Gene *best_tour;
Rel *best_rel; RelOptInfo *best_rel;
/* Plan *best_plan; */ /* Plan *best_plan; */
@ -254,7 +254,7 @@ geqo(Query *root)
best_tour = (Gene *) pool->data[0].string; best_tour = (Gene *) pool->data[0].string;
/* root->join_relation_list_ will be modified during this ! */ /* root->join_relation_list_ will be modified during this ! */
best_rel = (Rel *) gimme_tree(root, best_tour, 0, pool->string_length, NULL); best_rel = (RelOptInfo *) gimme_tree(root, best_tour, 0, pool->string_length, NULL);
/* DBG: show the query plan /* DBG: show the query plan
print_plan(best_plan, root); print_plan(best_plan, root);

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo_misc.c,v 1.8 1998/06/15 19:28:35 momjian Exp $ * $Id: geqo_misc.c,v 1.9 1998/07/18 04:22:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -262,7 +262,7 @@ geqo_print_path(Query *root, Path *path, int indent)
} }
void void
geqo_print_rel(Query *root, Rel *rel) geqo_print_rel(Query *root, RelOptInfo *rel)
{ {
List *l; List *l;

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo_paths.c,v 1.9 1998/06/15 19:28:37 momjian Exp $ * $Id: geqo_paths.c,v 1.10 1998/07/18 04:22:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -28,8 +28,8 @@
#include "optimizer/geqo_paths.h" #include "optimizer/geqo_paths.h"
static List *geqo_prune_rel(Rel *rel, List *other_rels); static List *geqo_prune_rel(RelOptInfo *rel, List *other_rels);
static Path *set_paths(Rel *rel, Path *unorderedpath); static Path *set_paths(RelOptInfo *rel, Path *unorderedpath);
/* /*
* geqo-prune-rels-- * geqo-prune-rels--
@ -47,7 +47,7 @@ geqo_prune_rels(List *rel_list)
if (rel_list != NIL) if (rel_list != NIL)
{ {
temp_list = lcons(lfirst(rel_list), temp_list = lcons(lfirst(rel_list),
geqo_prune_rels(geqo_prune_rel((Rel *) lfirst(rel_list), geqo_prune_rels(geqo_prune_rel((RelOptInfo *) lfirst(rel_list),
lnext(rel_list)))); lnext(rel_list))));
} }
return (temp_list); return (temp_list);
@ -65,16 +65,16 @@ geqo_prune_rels(List *rel_list)
* *
*/ */
static List * static List *
geqo_prune_rel(Rel *rel, List *other_rels) geqo_prune_rel(RelOptInfo *rel, List *other_rels)
{ {
List *i = NIL; List *i = NIL;
List *t_list = NIL; List *t_list = NIL;
List *temp_node = NIL; List *temp_node = NIL;
Rel *other_rel = (Rel *) NULL; RelOptInfo *other_rel = (RelOptInfo *) NULL;
foreach(i, other_rels) foreach(i, other_rels)
{ {
other_rel = (Rel *) lfirst(i); other_rel = (RelOptInfo *) lfirst(i);
if (same(rel->relids, other_rel->relids)) if (same(rel->relids, other_rel->relids))
{ {
rel->pathlist = add_pathlist(rel, rel->pathlist = add_pathlist(rel,
@ -102,7 +102,7 @@ geqo_prune_rel(Rel *rel, List *other_rels)
* *
*/ */
void void
geqo_rel_paths(Rel *rel) geqo_rel_paths(RelOptInfo *rel)
{ {
List *y = NIL; List *y = NIL;
Path *path = (Path *) NULL; Path *path = (Path *) NULL;
@ -134,7 +134,7 @@ geqo_rel_paths(Rel *rel)
* *
*/ */
static Path * static Path *
set_paths(Rel *rel, Path *unorderedpath) set_paths(RelOptInfo *rel, Path *unorderedpath)
{ {
Path *cheapest = set_cheapest(rel, rel->pathlist); Path *cheapest = set_cheapest(rel, rel->pathlist);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.5 1998/06/15 19:28:38 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.6 1998/07/18 04:22:29 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -41,7 +41,7 @@
*/ */
void void
minspantree(Query *root, List *join_rels, Rel *garel) minspantree(Query *root, List *join_rels, RelOptInfo *garel)
{ {
int number_of_rels = length(root->base_relation_list_); int number_of_rels = length(root->base_relation_list_);
int number_of_joins = length(join_rels); int number_of_joins = length(join_rels);
@ -70,28 +70,28 @@ minspantree(Query *root, List *join_rels, Rel *garel)
id1, id1,
id2; id2;
List *r = NIL; List *r = NIL;
Rel *joinrel = NULL; RelOptInfo *joinrel = NULL;
Rel **tmprel_array; RelOptInfo **tmprel_array;
/* allocate memory for matrix tmprel_array[x][y] */ /* allocate memory for matrix tmprel_array[x][y] */
tmprel_array = (Rel **) palloc((number_of_rels + 1) * sizeof(Rel *)); tmprel_array = (RelOptInfo **) palloc((number_of_rels + 1) * sizeof(RelOptInfo *));
for (i = 0; i <= number_of_rels; i++) for (i = 0; i <= number_of_rels; i++)
(tmprel_array[i] = (Rel *) palloc((number_of_rels + 1) * sizeof(Rel))); (tmprel_array[i] = (RelOptInfo *) palloc((number_of_rels + 1) * sizeof(RelOptInfo)));
/* read relations of join-relations into tmprel_array */ /* read relations of join-relations into tmprel_array */
foreach(r, join_rels) foreach(r, join_rels)
{ {
joinrel = (Rel *) lfirst(r); joinrel = (RelOptInfo *) lfirst(r);
id1 = (int) lfirst(joinrel->relids); id1 = (int) lfirst(joinrel->relids);
id2 = (int) lsecond(joinrel->relids); id2 = (int) lsecond(joinrel->relids);
if (id1 > id2) if (id1 > id2)
tmprel_array[id2][id1] = *(Rel *) joinrel; tmprel_array[id2][id1] = *(RelOptInfo *) joinrel;
else else
{ {
tmprel_array[id1][id2] = *(Rel *) joinrel; /* ever reached? */ tmprel_array[id1][id2] = *(RelOptInfo *) joinrel; /* ever reached? */
} }
} }
@ -103,7 +103,7 @@ minspantree(Query *root, List *join_rels, Rel *garel)
i = 1; i = 1;
foreach(r, join_rels) foreach(r, join_rels)
{ {
garel[i] = *(Rel *) lfirst(r); garel[i] = *(RelOptInfo *) lfirst(r);
i++; i++;
} }
} }
@ -111,9 +111,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
else if (number_of_joins == 3) else if (number_of_joins == 3)
{ {
Rel *rel12 = (Rel *) &tmprel_array[1][2]; RelOptInfo *rel12 = (RelOptInfo *) &tmprel_array[1][2];
Rel *rel13 = (Rel *) &tmprel_array[1][3]; RelOptInfo *rel13 = (RelOptInfo *) &tmprel_array[1][3];
Rel *rel23 = (Rel *) &tmprel_array[2][3]; RelOptInfo *rel23 = (RelOptInfo *) &tmprel_array[2][3];
if (rel12->cheapestpath->path_cost > rel13->cheapestpath->path_cost) if (rel12->cheapestpath->path_cost > rel13->cheapestpath->path_cost)
{ {
@ -159,9 +159,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
if (connectto[tempn] != 0) if (connectto[tempn] != 0)
{ {
if (n > tempn) if (n > tempn)
joinrel = (Rel *) &tmprel_array[tempn][n]; joinrel = (RelOptInfo *) &tmprel_array[tempn][n];
else else
joinrel = (Rel *) &tmprel_array[n][tempn]; joinrel = (RelOptInfo *) &tmprel_array[n][tempn];
dist = joinrel->cheapestpath->path_cost; dist = joinrel->cheapestpath->path_cost;
if (dist < disttoconnect[tempn]) if (dist < disttoconnect[tempn])

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.16 1998/06/15 19:28:38 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.17 1998/07/18 04:22:29 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -105,7 +105,7 @@ static void
find_rel_paths(Query *root, List *rels) find_rel_paths(Query *root, List *rels)
{ {
List *temp; List *temp;
Rel *rel; RelOptInfo *rel;
List *lastpath; List *lastpath;
foreach(temp, rels) foreach(temp, rels)
@ -114,7 +114,7 @@ find_rel_paths(Query *root, List *rels)
List *rel_index_scan_list; List *rel_index_scan_list;
List *or_index_scan_list; List *or_index_scan_list;
rel = (Rel *) lfirst(temp); rel = (RelOptInfo *) lfirst(temp);
sequential_scan_list = lcons(create_seqscan_path(rel), sequential_scan_list = lcons(create_seqscan_path(rel),
NIL); NIL);
@ -175,7 +175,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
{ {
List *x; List *x;
List *new_rels = NIL; List *new_rels = NIL;
Rel *rel; RelOptInfo *rel;
/******************************************* /*******************************************
* genetic query optimizer entry point * * genetic query optimizer entry point *
@ -183,7 +183,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*******************************************/ *******************************************/
if ((_use_geqo_) && length(root->base_relation_list_) >= _use_geqo_rels_) if ((_use_geqo_) && length(root->base_relation_list_) >= _use_geqo_rels_)
return lcons(geqo(root), NIL); /* returns *one* Rel, so lcons it */ return lcons(geqo(root), NIL); /* returns *one* RelOptInfo, so lcons it */
/******************************************* /*******************************************
* rest will be deprecated in case of GEQO * * rest will be deprecated in case of GEQO *
@ -212,7 +212,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*/ */
if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF) if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF)
foreach(x, new_rels) foreach(x, new_rels)
xfunc_trypullup((Rel *) lfirst(x)); xfunc_trypullup((RelOptInfo *) lfirst(x));
#endif #endif
prune_rel_paths(new_rels); prune_rel_paths(new_rels);
@ -231,7 +231,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
foreach(x, new_rels) foreach(x, new_rels)
{ {
rel = (Rel *) lfirst(x); rel = (RelOptInfo *) lfirst(x);
if (rel->size <= 0) if (rel->size <= 0)
rel->size = compute_rel_size(rel); rel->size = compute_rel_size(rel);
rel->width = compute_rel_width(rel); rel->width = compute_rel_width(rel);
@ -399,7 +399,7 @@ print_path(Query *root, Path *path, int indent)
} }
static void static void
debug_print_rel(Query *root, Rel *rel) debug_print_rel(Query *root, RelOptInfo *rel)
{ {
List *l; List *l;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.8 1998/06/15 19:28:39 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.9 1998/07/18 04:22:30 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -95,12 +95,12 @@ product_selec(List *clauseinfo_list)
void void
set_rest_relselec(Query *root, List *rel_list) set_rest_relselec(Query *root, List *rel_list)
{ {
Rel *rel; RelOptInfo *rel;
List *x; List *x;
foreach(x, rel_list) foreach(x, rel_list)
{ {
rel = (Rel *) lfirst(x); rel = (RelOptInfo *) lfirst(x);
set_rest_selec(root, rel->clauseinfo); set_rest_selec(root, rel->clauseinfo);
} }
} }

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.21 1998/06/15 19:28:39 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.22 1998/07/18 04:22:31 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -360,7 +360,7 @@ cost_hashjoin(Cost outercost,
* Returns the size. * Returns the size.
*/ */
int int
compute_rel_size(Rel *rel) compute_rel_size(RelOptInfo *rel)
{ {
Cost temp; Cost temp;
int temp1; int temp1;
@ -383,7 +383,7 @@ compute_rel_size(Rel *rel)
* Returns the width of the tuple as a fixnum. * Returns the width of the tuple as a fixnum.
*/ */
int int
compute_rel_width(Rel *rel) compute_rel_width(RelOptInfo *rel)
{ {
return (compute_targetlist_width(get_actual_tlist(rel->targetlist))); return (compute_targetlist_width(get_actual_tlist(rel->targetlist)));
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.16 1998/06/15 19:28:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.17 1998/07/18 04:22:31 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -42,22 +42,22 @@
static void static void
match_index_orclauses(Rel *rel, Rel *index, int indexkey, match_index_orclauses(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, List *clauseinfo_list); int xclass, List *clauseinfo_list);
static bool static bool
match_index_to_operand(int indexkey, Expr *operand, match_index_to_operand(int indexkey, Expr *operand,
Rel *rel, Rel *index); RelOptInfo *rel, RelOptInfo *index);
static List * static List *
match_index_orclause(Rel *rel, Rel *index, int indexkey, match_index_orclause(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, List *or_clauses, List *other_matching_indices); int xclass, List *or_clauses, List *other_matching_indices);
static List * static List *
group_clauses_by_indexkey(Rel *rel, Rel *index, group_clauses_by_indexkey(RelOptInfo *rel, RelOptInfo *index,
int *indexkeys, Oid *classes, List *clauseinfo_list); int *indexkeys, Oid *classes, List *clauseinfo_list);
static List * static List *
group_clauses_by_ikey_for_joins(Rel *rel, Rel *index, group_clauses_by_ikey_for_joins(RelOptInfo *rel, RelOptInfo *index,
int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list); int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list);
static CInfo * static CInfo *
match_clause_to_indexkey(Rel *rel, Rel *index, int indexkey, match_clause_to_indexkey(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, CInfo *clauseInfo, bool join); int xclass, CInfo *clauseInfo, bool join);
static bool static bool
pred_test(List *predicate_list, List *clauseinfo_list, pred_test(List *predicate_list, List *clauseinfo_list,
@ -67,17 +67,17 @@ static bool one_pred_clause_expr_test(Expr *predicate, Node *clause);
static bool one_pred_clause_test(Expr *predicate, Node *clause); static bool one_pred_clause_test(Expr *predicate, Node *clause);
static bool clause_pred_clause_test(Expr *predicate, Node *clause); static bool clause_pred_clause_test(Expr *predicate, Node *clause);
static List * static List *
indexable_joinclauses(Rel *rel, Rel *index, indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
List *joininfo_list, List *clauseinfo_list); List *joininfo_list, List *clauseinfo_list);
static List * static List *
index_innerjoin(Query *root, Rel *rel, index_innerjoin(Query *root, RelOptInfo *rel,
List *clausegroup_list, Rel *index); List *clausegroup_list, RelOptInfo *index);
static List * static List *
create_index_paths(Query *root, Rel *rel, Rel *index, create_index_paths(Query *root, RelOptInfo *rel, RelOptInfo *index,
List *clausegroup_list, bool join); List *clausegroup_list, bool join);
static List *add_index_paths(List *indexpaths, List *new_indexpaths); static List *add_index_paths(List *indexpaths, List *new_indexpaths);
static bool function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index); static bool function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index);
static bool SingleAttributeIndex(Rel *index); static bool SingleAttributeIndex(RelOptInfo *index);
/* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */ /* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */
#define BOOL_TYPEID ((Oid) 16) #define BOOL_TYPEID ((Oid) 16)
@ -110,14 +110,14 @@ static bool SingleAttributeIndex(Rel *index);
*/ */
List * List *
find_index_paths(Query *root, find_index_paths(Query *root,
Rel *rel, RelOptInfo *rel,
List *indices, List *indices,
List *clauseinfo_list, List *clauseinfo_list,
List *joininfo_list) List *joininfo_list)
{ {
List *scanclausegroups = NIL; List *scanclausegroups = NIL;
List *scanpaths = NIL; List *scanpaths = NIL;
Rel *index = (Rel *) NULL; RelOptInfo *index = (RelOptInfo *) NULL;
List *joinclausegroups = NIL; List *joinclausegroups = NIL;
List *joinpaths = NIL; List *joinpaths = NIL;
List *retval = NIL; List *retval = NIL;
@ -125,7 +125,7 @@ find_index_paths(Query *root,
if (indices == NIL) if (indices == NIL)
return (NULL); return (NULL);
index = (Rel *) lfirst(indices); index = (RelOptInfo *) lfirst(indices);
retval = find_index_paths(root, retval = find_index_paths(root,
rel, rel,
@ -235,8 +235,8 @@ find_index_paths(Query *root,
* *
*/ */
static void static void
match_index_orclauses(Rel *rel, match_index_orclauses(RelOptInfo *rel,
Rel *index, RelOptInfo *index,
int indexkey, int indexkey,
int xclass, int xclass,
List *clauseinfo_list) List *clauseinfo_list)
@ -273,8 +273,8 @@ match_index_orclauses(Rel *rel,
static bool static bool
match_index_to_operand(int indexkey, match_index_to_operand(int indexkey,
Expr *operand, Expr *operand,
Rel *rel, RelOptInfo *rel,
Rel *index) RelOptInfo *index)
{ {
/* /*
@ -311,8 +311,8 @@ match_index_to_operand(int indexkey,
* match the third, g,h match the fourth, etc. * match the third, g,h match the fourth, etc.
*/ */
static List * static List *
match_index_orclause(Rel *rel, match_index_orclause(RelOptInfo *rel,
Rel *index, RelOptInfo *index,
int indexkey, int indexkey,
int xclass, int xclass,
List *or_clauses, List *or_clauses,
@ -393,8 +393,8 @@ match_index_orclause(Rel *rel,
* *
*/ */
static List * static List *
group_clauses_by_indexkey(Rel *rel, group_clauses_by_indexkey(RelOptInfo *rel,
Rel *index, RelOptInfo *index,
int *indexkeys, int *indexkeys,
Oid *classes, Oid *classes,
List *clauseinfo_list) List *clauseinfo_list)
@ -455,8 +455,8 @@ group_clauses_by_indexkey(Rel *rel,
* *
*/ */
static List * static List *
group_clauses_by_ikey_for_joins(Rel *rel, group_clauses_by_ikey_for_joins(RelOptInfo *rel,
Rel *index, RelOptInfo *index,
int *indexkeys, int *indexkeys,
Oid *classes, Oid *classes,
List *join_cinfo_list, List *join_cinfo_list,
@ -578,8 +578,8 @@ group_clauses_by_ikey_for_joins(Rel *rel,
* *
*/ */
static CInfo * static CInfo *
match_clause_to_indexkey(Rel *rel, match_clause_to_indexkey(RelOptInfo *rel,
Rel *index, RelOptInfo *index,
int indexkey, int indexkey,
int xclass, int xclass,
CInfo *clauseInfo, CInfo *clauseInfo,
@ -1102,7 +1102,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
* *
*/ */
static List * static List *
indexable_joinclauses(Rel *rel, Rel *index, indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
List *joininfo_list, List *clauseinfo_list) List *joininfo_list, List *clauseinfo_list)
{ {
JInfo *joininfo = (JInfo *) NULL; JInfo *joininfo = (JInfo *) NULL;
@ -1176,7 +1176,7 @@ extract_restrict_clauses(List *clausegroup)
* *
*/ */
static List * static List *
index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index) index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list, RelOptInfo *index)
{ {
List *clausegroup = NIL; List *clausegroup = NIL;
List *cg_list = NIL; List *cg_list = NIL;
@ -1262,8 +1262,8 @@ index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
*/ */
static List * static List *
create_index_paths(Query *root, create_index_paths(Query *root,
Rel *rel, RelOptInfo *rel,
Rel *index, RelOptInfo *index,
List *clausegroup_list, List *clausegroup_list,
bool join) bool join)
{ {
@ -1308,7 +1308,7 @@ add_index_paths(List *indexpaths, List *new_indexpaths)
} }
static bool static bool
function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index) function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index)
{ {
Oid heapRelid = (Oid) lfirsti(rel->relids); Oid heapRelid = (Oid) lfirsti(rel->relids);
Func *function; Func *function;
@ -1368,7 +1368,7 @@ function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index)
} }
static bool static bool
SingleAttributeIndex(Rel *index) SingleAttributeIndex(RelOptInfo *index)
{ {
/* /*

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.6 1998/06/15 19:28:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.7 1998/07/18 04:22:32 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -31,18 +31,18 @@
static Path *best_innerjoin(List *join_paths, List *outer_relid); static Path *best_innerjoin(List *join_paths, List *outer_relid);
static List * static List *
sort_inner_and_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel, sort_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *mergeinfo_list); List *mergeinfo_list);
static List * static List *
match_unsorted_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel, match_unsorted_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *outerpath_list, Path *cheapest_inner, Path *best_innerjoin, List *outerpath_list, Path *cheapest_inner, Path *best_innerjoin,
List *mergeinfo_list); List *mergeinfo_list);
static List * static List *
match_unsorted_inner(Rel *joinrel, Rel *outerrel, Rel *innerrel, match_unsorted_inner(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *innerpath_list, List *mergeinfo_list); List *innerpath_list, List *mergeinfo_list);
static bool EnoughMemoryForHashjoin(Rel *hashrel); static bool EnoughMemoryForHashjoin(RelOptInfo *hashrel);
static List * static List *
hash_inner_and_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel, hash_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *hashinfo_list); List *hashinfo_list);
/* /*
@ -76,11 +76,11 @@ find_all_join_paths(Query *root, List *joinrels)
while (joinrels != NIL) while (joinrels != NIL)
{ {
Rel *joinrel = (Rel *) lfirst(joinrels); RelOptInfo *joinrel = (RelOptInfo *) lfirst(joinrels);
List *innerrelids; List *innerrelids;
List *outerrelids; List *outerrelids;
Rel *innerrel; RelOptInfo *innerrel;
Rel *outerrel; RelOptInfo *outerrel;
Path *bestinnerjoin; Path *bestinnerjoin;
List *pathlist = NIL; List *pathlist = NIL;
@ -238,9 +238,9 @@ best_innerjoin(List *join_paths, List *outer_relids)
* Returns a list of mergesort paths. * Returns a list of mergesort paths.
*/ */
static List * static List *
sort_inner_and_outer(Rel *joinrel, sort_inner_and_outer(RelOptInfo *joinrel,
Rel *outerrel, RelOptInfo *outerrel,
Rel *innerrel, RelOptInfo *innerrel,
List *mergeinfo_list) List *mergeinfo_list)
{ {
List *ms_list = NIL; List *ms_list = NIL;
@ -316,9 +316,9 @@ sort_inner_and_outer(Rel *joinrel,
* Returns a list of possible join path nodes. * Returns a list of possible join path nodes.
*/ */
static List * static List *
match_unsorted_outer(Rel *joinrel, match_unsorted_outer(RelOptInfo *joinrel,
Rel *outerrel, RelOptInfo *outerrel,
Rel *innerrel, RelOptInfo *innerrel,
List *outerpath_list, List *outerpath_list,
Path *cheapest_inner, Path *cheapest_inner,
Path *best_innerjoin, Path *best_innerjoin,
@ -469,9 +469,9 @@ match_unsorted_outer(Rel *joinrel,
* Returns a list of possible merge paths. * Returns a list of possible merge paths.
*/ */
static List * static List *
match_unsorted_inner(Rel *joinrel, match_unsorted_inner(RelOptInfo *joinrel,
Rel *outerrel, RelOptInfo *outerrel,
Rel *innerrel, RelOptInfo *innerrel,
List *innerpath_list, List *innerpath_list,
List *mergeinfo_list) List *mergeinfo_list)
{ {
@ -565,7 +565,7 @@ match_unsorted_inner(Rel *joinrel,
} }
static bool static bool
EnoughMemoryForHashjoin(Rel *hashrel) EnoughMemoryForHashjoin(RelOptInfo *hashrel)
{ {
int ntuples; int ntuples;
int tupsize; int tupsize;
@ -599,9 +599,9 @@ EnoughMemoryForHashjoin(Rel *hashrel)
* Returns a list of hashjoin paths. * Returns a list of hashjoin paths.
*/ */
static List * static List *
hash_inner_and_outer(Rel *joinrel, hash_inner_and_outer(RelOptInfo *joinrel,
Rel *outerrel, RelOptInfo *outerrel,
Rel *innerrel, RelOptInfo *innerrel,
List *hashinfo_list) List *hashinfo_list)
{ {
HInfo *xhashinfo = (HInfo *) NULL; HInfo *xhashinfo = (HInfo *) NULL;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.10 1998/06/15 19:28:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.11 1998/07/18 04:22:33 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -31,18 +31,18 @@ bool _use_right_sided_plans_ = false;
#endif #endif
static List *find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list); static List *find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list);
static List *find_clauseless_joins(Rel *outer_rel, List *inner_rels); static List *find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels);
static Rel *init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo); static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo);
static List * static List *
new_join_tlist(List *tlist, List *other_relids, new_join_tlist(List *tlist, List *other_relids,
int first_resdomno); int first_resdomno);
static List *new_joininfo_list(List *joininfo_list, List *join_relids); static List *new_joininfo_list(List *joininfo_list, List *join_relids);
static void add_superrels(Rel *rel, Rel *super_rel); static void add_superrels(RelOptInfo *rel, RelOptInfo *super_rel);
static bool nonoverlap_rels(Rel *rel1, Rel *rel2); static bool nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2);
static bool nonoverlap_sets(List *s1, List *s2); static bool nonoverlap_sets(List *s1, List *s2);
static void static void
set_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel, set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel,
JInfo *jinfo); JInfo *jinfo);
/* /*
@ -67,7 +67,7 @@ find_join_rels(Query *root, List *outer_rels)
foreach(r, outer_rels) foreach(r, outer_rels)
{ {
Rel *outer_rel = (Rel *) lfirst(r); RelOptInfo *outer_rel = (RelOptInfo *) lfirst(r);
if (!(joins = find_clause_joins(root, outer_rel, outer_rel->joininfo))) if (!(joins = find_clause_joins(root, outer_rel, outer_rel->joininfo)))
{ {
@ -99,7 +99,7 @@ find_join_rels(Query *root, List *outer_rels)
* Returns a list of new join relations. * Returns a list of new join relations.
*/ */
static List * static List *
find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list) find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
{ {
List *join_list = NIL; List *join_list = NIL;
List *i = NIL; List *i = NIL;
@ -107,7 +107,7 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
foreach(i, joininfo_list) foreach(i, joininfo_list)
{ {
JInfo *joininfo = (JInfo *) lfirst(i); JInfo *joininfo = (JInfo *) lfirst(i);
Rel *rel; RelOptInfo *rel;
if (!joininfo->inactive) if (!joininfo->inactive)
{ {
@ -158,16 +158,16 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
* Returns a list of new join relations. * Returns a list of new join relations.
*/ */
static List * static List *
find_clauseless_joins(Rel *outer_rel, List *inner_rels) find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
{ {
Rel *inner_rel; RelOptInfo *inner_rel;
List *t_list = NIL; List *t_list = NIL;
List *temp_node = NIL; List *temp_node = NIL;
List *i = NIL; List *i = NIL;
foreach(i, inner_rels) foreach(i, inner_rels)
{ {
inner_rel = (Rel *) lfirst(i); inner_rel = (RelOptInfo *) lfirst(i);
if (nonoverlap_rels(inner_rel, outer_rel)) if (nonoverlap_rels(inner_rel, outer_rel))
{ {
temp_node = lcons(init_join_rel(outer_rel, temp_node = lcons(init_join_rel(outer_rel,
@ -192,10 +192,10 @@ find_clauseless_joins(Rel *outer_rel, List *inner_rels)
* *
* Returns the new join relation node. * Returns the new join relation node.
*/ */
static Rel * static RelOptInfo *
init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo) init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
{ {
Rel *joinrel = makeNode(Rel); RelOptInfo *joinrel = makeNode(RelOptInfo);
List *joinrel_joininfo_list = NIL; List *joinrel_joininfo_list = NIL;
List *new_outer_tlist; List *new_outer_tlist;
List *new_inner_tlist; List *new_inner_tlist;
@ -396,19 +396,19 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xjoinrel, joinrels) foreach(xjoinrel, joinrels)
{ {
Rel *joinrel = (Rel *) lfirst(xjoinrel); RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids) foreach(xrelid, joinrel->relids)
{ {
Relid relid = (Relid) lfirst(xrelid); Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid); RelOptInfo *rel = get_join_rel(root, relid);
add_superrels(rel, joinrel); add_superrels(rel, joinrel);
} }
} }
foreach(xjoinrel, joinrels) foreach(xjoinrel, joinrels)
{ {
Rel *joinrel = (Rel *) lfirst(xjoinrel); RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo) foreach(xjoininfo, joinrel->joininfo)
{ {
@ -421,7 +421,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xrelid, other_rels) foreach(xrelid, other_rels)
{ {
Relid relid = (Relid) lfirst(xrelid); Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid); RelOptInfo *rel = get_join_rel(root, relid);
List *super_rels = rel->superrels; List *super_rels = rel->superrels;
List *xsuper_rel = NIL; List *xsuper_rel = NIL;
JInfo *new_joininfo = makeNode(JInfo); JInfo *new_joininfo = makeNode(JInfo);
@ -436,7 +436,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xsuper_rel, super_rels) foreach(xsuper_rel, super_rels)
{ {
Rel *super_rel = (Rel *) lfirst(xsuper_rel); RelOptInfo *super_rel = (RelOptInfo *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel)) if (nonoverlap_rels(super_rel, joinrel))
{ {
@ -471,7 +471,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
} }
foreach(xrel, outerrels) foreach(xrel, outerrels)
{ {
Rel *rel = (Rel *) lfirst(xrel); RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
rel->superrels = NIL; rel->superrels = NIL;
} }
@ -499,7 +499,7 @@ final_join_rels(List *join_rel_list)
*/ */
foreach(xrel, join_rel_list) foreach(xrel, join_rel_list)
{ {
Rel *rel = (Rel *) lfirst(xrel); RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
List *xjoininfo = NIL; List *xjoininfo = NIL;
bool final = true; bool final = true;
@ -533,7 +533,7 @@ final_join_rels(List *join_rel_list)
* Modifies the superrels field of rel * Modifies the superrels field of rel
*/ */
static void static void
add_superrels(Rel *rel, Rel *super_rel) add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
{ {
rel->superrels = lappend(rel->superrels, super_rel); rel->superrels = lappend(rel->superrels, super_rel);
} }
@ -548,7 +548,7 @@ add_superrels(Rel *rel, Rel *super_rel)
* Returns non-nil if rel1 and rel2 do not overlap. * Returns non-nil if rel1 and rel2 do not overlap.
*/ */
static bool static bool
nonoverlap_rels(Rel *rel1, Rel *rel2) nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
{ {
return (nonoverlap_sets(rel1->relids, rel2->relids)); return (nonoverlap_sets(rel1->relids, rel2->relids));
} }
@ -569,7 +569,7 @@ nonoverlap_sets(List *s1, List *s2)
} }
static void static void
set_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel, JInfo *jinfo) set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *jinfo)
{ {
int ntuples; int ntuples;
float selec; float selec;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.6 1998/06/15 19:28:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.7 1998/07/18 04:22:33 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -32,11 +32,11 @@
static void static void
best_or_subclause_indices(Query *root, Rel *rel, List *subclauses, best_or_subclause_indices(Query *root, RelOptInfo *rel, List *subclauses,
List *indices, List *examined_indexids, Cost subcost, List *selectivities, List *indices, List *examined_indexids, Cost subcost, List *selectivities,
List **indexids, Cost *cost, List **selecs); List **indexids, Cost *cost, List **selecs);
static void static void
best_or_subclause_index(Query *root, Rel *rel, Expr *subclause, best_or_subclause_index(Query *root, RelOptInfo *rel, Expr *subclause,
List *indices, int *indexid, Cost *cost, Cost *selec); List *indices, int *indexid, Cost *cost, Cost *selec);
@ -52,7 +52,7 @@ best_or_subclause_index(Query *root, Rel *rel, Expr *subclause,
*/ */
List * List *
create_or_index_paths(Query *root, create_or_index_paths(Query *root,
Rel *rel, List *clauses) RelOptInfo *rel, List *clauses)
{ {
List *t_list = NIL; List *t_list = NIL;
@ -157,7 +157,7 @@ create_or_index_paths(Query *root,
*/ */
static void static void
best_or_subclause_indices(Query *root, best_or_subclause_indices(Query *root,
Rel *rel, RelOptInfo *rel,
List *subclauses, List *subclauses,
List *indices, List *indices,
List *examined_indexids, List *examined_indexids,
@ -212,7 +212,7 @@ best_or_subclause_indices(Query *root,
*/ */
static void static void
best_or_subclause_index(Query *root, best_or_subclause_index(Query *root,
Rel *rel, RelOptInfo *rel,
Expr *subclause, Expr *subclause,
List *indices, List *indices,
int *retIndexid, /* return value */ int *retIndexid, /* return value */
@ -224,7 +224,7 @@ best_or_subclause_index(Query *root,
Datum value; Datum value;
int flag = 0; int flag = 0;
Cost subcost; Cost subcost;
Rel *index = (Rel *) lfirst(indices); RelOptInfo *index = (RelOptInfo *) lfirst(indices);
AttrNumber attno = (get_leftop(subclause))->varattno; AttrNumber attno = (get_leftop(subclause))->varattno;
Oid opno = ((Oper *) subclause->oper)->opno; Oid opno = ((Oper *) subclause->oper)->opno;
bool constant_on_right = non_null((Expr *) get_rightop(subclause)); bool constant_on_right = non_null((Expr *) get_rightop(subclause));

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.14 1998/06/15 19:28:41 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.15 1998/07/18 04:22:34 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -24,7 +24,7 @@
#include "utils/elog.h" #include "utils/elog.h"
static List *prune_joinrel(Rel *rel, List *other_rels); static List *prune_joinrel(RelOptInfo *rel, List *other_rels);
/* /*
* prune-joinrels-- * prune-joinrels--
@ -44,7 +44,7 @@ prune_joinrels(List *rel_list)
* deleted * deleted
*/ */
foreach(i, rel_list) foreach(i, rel_list)
lnext(i) = prune_joinrel((Rel *) lfirst(i), lnext(i)); lnext(i) = prune_joinrel((RelOptInfo *) lfirst(i), lnext(i));
} }
/* /*
@ -59,14 +59,14 @@ prune_joinrels(List *rel_list)
* *
*/ */
static List * static List *
prune_joinrel(Rel *rel, List *other_rels) prune_joinrel(RelOptInfo *rel, List *other_rels)
{ {
List *i = NIL; List *i = NIL;
List *result = NIL; List *result = NIL;
foreach(i, other_rels) foreach(i, other_rels)
{ {
Rel *other_rel = (Rel *) lfirst(i); RelOptInfo *other_rel = (RelOptInfo *) lfirst(i);
if (same(rel->relids, other_rel->relids)) if (same(rel->relids, other_rel->relids))
{ {
@ -96,12 +96,12 @@ prune_rel_paths(List *rel_list)
List *x = NIL; List *x = NIL;
List *y = NIL; List *y = NIL;
Path *path = NULL; Path *path = NULL;
Rel *rel = (Rel *) NULL; RelOptInfo *rel = (RelOptInfo *) NULL;
JoinPath *cheapest = (JoinPath *) NULL; JoinPath *cheapest = (JoinPath *) NULL;
foreach(x, rel_list) foreach(x, rel_list)
{ {
rel = (Rel *) lfirst(x); rel = (RelOptInfo *) lfirst(x);
rel->size = 0; rel->size = 0;
foreach(y, rel->pathlist) foreach(y, rel->pathlist)
{ {
@ -130,7 +130,7 @@ prune_rel_paths(List *rel_list)
* *
*/ */
Path * Path *
prune_rel_path(Rel *rel, Path *unorderedpath) prune_rel_path(RelOptInfo *rel, Path *unorderedpath)
{ {
Path *cheapest = set_cheapest(rel, rel->pathlist); Path *cheapest = set_cheapest(rel, rel->pathlist);
@ -165,7 +165,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
foreach(xrel, rel_list1) foreach(xrel, rel_list1)
{ {
Rel *rel = (Rel *) lfirst(xrel); RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
rel_list2 = prune_joinrel(rel, rel_list2); rel_list2 = prune_joinrel(rel, rel_list2);
} }
@ -187,7 +187,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
List * List *
prune_oldrels(List *old_rels) prune_oldrels(List *old_rels)
{ {
Rel *rel; RelOptInfo *rel;
List *joininfo_list, List *joininfo_list,
*xjoininfo, *xjoininfo,
*i, *i,
@ -195,7 +195,7 @@ prune_oldrels(List *old_rels)
foreach(i, old_rels) foreach(i, old_rels)
{ {
rel = (Rel *) lfirst(i); rel = (RelOptInfo *) lfirst(i);
joininfo_list = rel->joininfo; joininfo_list = rel->joininfo;
if (joininfo_list == NIL) if (joininfo_list == NIL)

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.15 1998/06/15 19:28:42 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.16 1998/07/18 04:22:34 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -57,7 +57,7 @@ xfunc_card_unreferenced(Query *queryInfo,
*/ */
void void
xfunc_trypullup(Rel rel) xfunc_trypullup(RelOptInfo rel)
{ {
LispValue y; /* list ptr */ LispValue y; /* list ptr */
CInfo maxcinfo; /* The CInfo to pull up, as calculated by CInfo maxcinfo; /* The CInfo to pull up, as calculated by
@ -242,7 +242,7 @@ xfunc_shouldpull(Query *queryInfo,
/* /*
* * we've left an expensive restriction below a join. Since * * * we've left an expensive restriction below a join. Since *
* we may pullup this restriction in predmig.c, we'd best * * we may pullup this restriction in predmig.c, we'd best *
* set the Rel of this join to be unpruneable * set the RelOptInfo of this join to be unpruneable
*/ */
set_pruneable(get_parent(parentpath), false); set_pruneable(get_parent(parentpath), false);
/* and fall through */ /* and fall through */
@ -256,8 +256,8 @@ xfunc_shouldpull(Query *queryInfo,
** xfunc_pullup -- ** xfunc_pullup --
** move clause from child pathnode to parent pathnode. This operation ** move clause from child pathnode to parent pathnode. This operation
** makes the child pathnode produce a larger relation than it used to. ** makes the child pathnode produce a larger relation than it used to.
** This means that we must construct a new Rel just for the childpath, ** This means that we must construct a new RelOptInfo just for the childpath,
** although this Rel will not be added to the list of Rels to be joined up ** although this RelOptInfo will not be added to the list of Rels to be joined up
** in the query; it's merely a parent for the new childpath. ** in the query; it's merely a parent for the new childpath.
** We also have to fix up the path costs of the child and parent. ** We also have to fix up the path costs of the child and parent.
** **
@ -272,7 +272,7 @@ xfunc_pullup(Query *queryInfo,
int clausetype) /* whether clause to pull is join or local */ int clausetype) /* whether clause to pull is join or local */
{ {
Path newkid; Path newkid;
Rel newrel; RelOptInfo newrel;
Cost pulled_selec; Cost pulled_selec;
Cost cost; Cost cost;
CInfo newinfo; CInfo newinfo;
@ -294,7 +294,7 @@ xfunc_pullup(Query *queryInfo,
} }
/* /*
* * give the new child path its own Rel node that reflects the * lack * * give the new child path its own RelOptInfo node that reflects the * lack
* of the pulled-up predicate * of the pulled-up predicate
*/ */
pulled_selec = compute_clause_selec(queryInfo, pulled_selec = compute_clause_selec(queryInfo,
@ -400,7 +400,7 @@ xfunc_join_expense(Query *queryInfo, JoinPath path, int whichchild)
/* /*
* * the second argument to xfunc_card_unreferenced reflects all the * * * the second argument to xfunc_card_unreferenced reflects all the *
* relations involved in the join clause, i.e. all the relids in the * relations involved in the join clause, i.e. all the relids in the
* Rel * of the join clause * RelOptInfo * of the join clause
*/ */
Count card = 0; Count card = 0;
Cost cost = xfunc_expense_per_tuple(path, whichchild); Cost cost = xfunc_expense_per_tuple(path, whichchild);
@ -736,9 +736,9 @@ xfunc_card_unreferenced(Query *queryInfo,
/* find all relids of base relations referenced in query */ /* find all relids of base relations referenced in query */
foreach(temp, queryInfo->base_relation_list_) foreach(temp, queryInfo->base_relation_list_)
{ {
Assert(lnext(get_relids((Rel) lfirst(temp))) == LispNil); Assert(lnext(get_relids((RelOptInfo) lfirst(temp))) == LispNil);
allrelids = lappend(allrelids, allrelids = lappend(allrelids,
lfirst(get_relids((Rel) lfirst(temp)))); lfirst(get_relids((RelOptInfo) lfirst(temp))));
} }
/* find all relids referenced in query but not in clause */ /* find all relids referenced in query but not in clause */
@ -758,7 +758,7 @@ xfunc_card_product(Query *queryInfo, Relid relids)
{ {
LispValue cinfonode; LispValue cinfonode;
LispValue temp; LispValue temp;
Rel currel; RelOptInfo currel;
Cost tuples; Cost tuples;
Count retval = 0; Count retval = 0;
@ -1095,8 +1095,8 @@ xfunc_total_path_cost(JoinPath pathnode)
Cost Cost
xfunc_expense_per_tuple(JoinPath joinnode, int whichchild) xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
{ {
Rel outerrel = get_parent((Path) get_outerjoinpath(joinnode)); RelOptInfo outerrel = get_parent((Path) get_outerjoinpath(joinnode));
Rel innerrel = get_parent((Path) get_innerjoinpath(joinnode)); RelOptInfo innerrel = get_parent((Path) get_innerjoinpath(joinnode));
Count outerwidth = get_width(outerrel); Count outerwidth = get_width(outerrel);
Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData))); Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
@ -1133,11 +1133,11 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
** nodes to point to the correct varno (either INNER or OUTER, depending ** nodes to point to the correct varno (either INNER or OUTER, depending
** on which child the clause was pulled from), and the right varattno in the ** on which child the clause was pulled from), and the right varattno in the
** target list of the child's former relation. If the target list of the ** target list of the child's former relation. If the target list of the
** child Rel does not contain the attribute we need, we add it. ** child RelOptInfo does not contain the attribute we need, we add it.
*/ */
void void
xfunc_fixvars(LispValue clause, /* clause being pulled up */ xfunc_fixvars(LispValue clause, /* clause being pulled up */
Rel rel, /* rel it's being pulled from */ RelOptInfo rel, /* rel it's being pulled from */
int varno) /* whether rel is INNER or OUTER of join */ int varno) /* whether rel is INNER or OUTER of join */
{ {
LispValue tmpclause; /* temporary variable */ LispValue tmpclause; /* temporary variable */
@ -1426,9 +1426,9 @@ do { \
** Just like _copyRel, but doesn't copy the paths ** Just like _copyRel, but doesn't copy the paths
*/ */
bool bool
xfunc_copyrel(Rel from, Rel *to) xfunc_copyrel(RelOptInfo from, RelOptInfo *to)
{ {
Rel newnode; RelOptInfo newnode;
Pointer (*alloc) () = palloc; Pointer (*alloc) () = palloc;
@ -1444,7 +1444,7 @@ xfunc_copyrel(Rel from, Rel *to)
} }
/* COPY_NEW(c) */ /* COPY_NEW(c) */
newnode = (Rel) (*alloc) (classSize(Rel)); newnode = (RelOptInfo) (*alloc) (classSize(RelOptInfo));
if (newnode == NULL) if (newnode == NULL)
return false; return false;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.28 1998/06/15 19:28:42 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.29 1998/07/18 04:22:36 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -106,7 +106,7 @@ create_plan(Path *best_path)
{ {
List *tlist; List *tlist;
Plan *plan_node = (Plan *) NULL; Plan *plan_node = (Plan *) NULL;
Rel *parent_rel; RelOptInfo *parent_rel;
int size; int size;
int width; int width;
int pages; int pages;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.12 1998/06/15 19:28:43 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.13 1998/07/18 04:22:37 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -79,7 +79,7 @@ initialize_base_rels_list(Query *root, List *tlist)
{ {
Var *var; Var *var;
Index varno; Index varno;
Rel *result; RelOptInfo *result;
var = (Var *) lfirst(tvar); var = (Var *) lfirst(tvar);
varno = var->varno; varno = var->varno;
@ -108,7 +108,7 @@ add_missing_vars_to_base_rels(Query *root, List *tlist)
{ {
RangeTblEntry *rte = (RangeTblEntry *) lfirst(l); RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
List *relids; List *relids;
Rel *result; RelOptInfo *result;
Var *var; Var *var;
relids = lconsi(varno, NIL); relids = lconsi(varno, NIL);
@ -187,7 +187,7 @@ add_clause_to_rels(Query *root, List *clause)
if (length(relids) == 1) if (length(relids) == 1)
{ {
Rel *rel = get_base_rel(root, lfirsti(relids)); RelOptInfo *rel = get_base_rel(root, lfirsti(relids));
/* /*
* There is only one relation participating in 'clause', so * There is only one relation participating in 'clause', so
@ -302,7 +302,7 @@ add_vars_to_rels(Query *root, List *vars, List *join_relids)
{ {
Var *var; Var *var;
List *temp = NIL; List *temp = NIL;
Rel *rel = (Rel *) NULL; RelOptInfo *rel = (RelOptInfo *) NULL;
TargetEntry *tlistentry; TargetEntry *tlistentry;
foreach(temp, vars) foreach(temp, vars)
@ -337,14 +337,14 @@ initialize_join_clause_info(List *rel_list)
List *x, List *x,
*y, *y,
*z; *z;
Rel *rel; RelOptInfo *rel;
JInfo *joininfo; JInfo *joininfo;
CInfo *clauseinfo; CInfo *clauseinfo;
Expr *clause; Expr *clause;
foreach(x, rel_list) foreach(x, rel_list)
{ {
rel = (Rel *) lfirst(x); rel = (RelOptInfo *) lfirst(x);
foreach(y, rel->joininfo) foreach(y, rel->joininfo)
{ {
joininfo = (JInfo *) lfirst(y); joininfo = (JInfo *) lfirst(y);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.22 1998/06/15 19:28:44 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.23 1998/07/18 04:22:37 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -250,7 +250,7 @@ subplanner(Query *root,
List *flat_tlist, List *flat_tlist,
List *qual) List *qual)
{ {
Rel *final_relation; RelOptInfo *final_relation;
List *final_relation_list; List *final_relation_list;
/* /*
@ -274,9 +274,9 @@ subplanner(Query *root,
root->base_relation_list_); root->base_relation_list_);
if (final_relation_list) if (final_relation_list)
final_relation = (Rel *) lfirst(final_relation_list); final_relation = (RelOptInfo *) lfirst(final_relation_list);
else else
final_relation = (Rel *) NIL; final_relation = (RelOptInfo *) NIL;
#if 0 /* fix xfunc */ #if 0 /* fix xfunc */

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.7 1998/06/15 19:28:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.8 1998/07/18 04:22:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -33,7 +33,7 @@ static List *find_secondary_index(Query *root, Oid relid);
* *
*/ */
List * List *
find_relation_indices(Query *root, Rel *rel) find_relation_indices(Query *root, RelOptInfo *rel)
{ {
if (rel->indexed) if (rel->indexed)
return (find_secondary_index(root, lfirsti(rel->relids))); return (find_secondary_index(root, lfirsti(rel->relids)));
@ -61,7 +61,7 @@ find_secondary_index(Query *root, Oid relid)
while (index_info(root, first, relid, &indexinfo)) while (index_info(root, first, relid, &indexinfo))
{ {
Rel *indexnode = makeNode(Rel); RelOptInfo *indexnode = makeNode(RelOptInfo);
indexnode->relids = lconsi(indexinfo.relid, NIL); indexnode->relids = lconsi(indexinfo.relid, NIL);
indexnode->relam = indexinfo.relam; indexnode->relam = indexinfo.relam;

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.7 1998/06/15 19:28:48 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.8 1998/07/18 04:22:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -62,7 +62,7 @@ joininfo_member(List *join_relids, List *joininfo_list)
* *
*/ */
JInfo * JInfo *
find_joininfo_node(Rel *this_rel, List *join_relids) find_joininfo_node(RelOptInfo *this_rel, List *join_relids)
{ {
JInfo *joininfo = joininfo_member(join_relids, JInfo *joininfo = joininfo_member(join_relids,
this_rel->joininfo); this_rel->joininfo);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.6 1998/02/26 04:33:19 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.7 1998/07/18 04:22:41 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -54,7 +54,7 @@ static bool equal_indexkey_var(int index_key, Var *var);
* *
*/ */
bool bool
match_indexkey_operand(int indexkey, Var *operand, Rel *rel) match_indexkey_operand(int indexkey, Var *operand, RelOptInfo *rel)
{ {
if (IsA(operand, Var) && if (IsA(operand, Var) &&
(lfirsti(rel->relids) == operand->varno) && (lfirsti(rel->relids) == operand->varno) &&

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.8 1998/06/15 19:28:49 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.9 1998/07/18 04:22:41 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -62,13 +62,13 @@ path_is_cheaper(Path *path1, Path *path2)
* *
*/ */
Path * Path *
set_cheapest(Rel *parent_rel, List *pathlist) set_cheapest(RelOptInfo *parent_rel, List *pathlist)
{ {
List *p; List *p;
Path *cheapest_so_far; Path *cheapest_so_far;
Assert(pathlist != NIL); Assert(pathlist != NIL);
Assert(IsA(parent_rel, Rel)); Assert(IsA(parent_rel, RelOptInfo));
cheapest_so_far = (Path *) lfirst(pathlist); cheapest_so_far = (Path *) lfirst(pathlist);
@ -99,7 +99,7 @@ set_cheapest(Rel *parent_rel, List *pathlist)
* *
*/ */
List * List *
add_pathlist(Rel *parent_rel, List *unique_paths, List *new_paths) add_pathlist(RelOptInfo *parent_rel, List *unique_paths, List *new_paths)
{ {
List *x; List *x;
Path *new_path; Path *new_path;
@ -200,7 +200,7 @@ better_path(Path *new_path, List *unique_paths, bool *noOther)
* *
*/ */
Path * Path *
create_seqscan_path(Rel *rel) create_seqscan_path(RelOptInfo *rel)
{ {
int relid = 0; int relid = 0;
@ -251,8 +251,8 @@ create_seqscan_path(Rel *rel)
*/ */
IndexPath * IndexPath *
create_index_path(Query *root, create_index_path(Query *root,
Rel *rel, RelOptInfo *rel,
Rel *index, RelOptInfo *index,
List *restriction_clauses, List *restriction_clauses,
bool is_join_scan) bool is_join_scan)
{ {
@ -406,8 +406,8 @@ create_index_path(Query *root,
* *
*/ */
JoinPath * JoinPath *
create_nestloop_path(Rel *joinrel, create_nestloop_path(RelOptInfo *joinrel,
Rel *outer_rel, RelOptInfo *outer_rel,
Path *outer_path, Path *outer_path,
Path *inner_path, Path *inner_path,
List *keys) List *keys)
@ -481,7 +481,7 @@ create_nestloop_path(Rel *joinrel,
* *
*/ */
MergePath * MergePath *
create_mergesort_path(Rel *joinrel, create_mergesort_path(RelOptInfo *joinrel,
int outersize, int outersize,
int innersize, int innersize,
int outerwidth, int outerwidth,
@ -547,7 +547,7 @@ create_mergesort_path(Rel *joinrel,
* *
*/ */
HashPath * HashPath *
create_hashjoin_path(Rel *joinrel, create_hashjoin_path(RelOptInfo *joinrel,
int outersize, int outersize,
int innersize, int innersize,
int outerwidth, int outerwidth,

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.5 1998/02/26 04:33:21 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.6 1998/07/18 04:22:41 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -27,17 +27,17 @@
* necessary. This is for base relations. * necessary. This is for base relations.
* *
*/ */
Rel * RelOptInfo *
get_base_rel(Query *root, int relid) get_base_rel(Query *root, int relid)
{ {
List *relids; List *relids;
Rel *rel; RelOptInfo *rel;
relids = lconsi(relid, NIL); relids = lconsi(relid, NIL);
rel = rel_member(relids, root->base_relation_list_); rel = rel_member(relids, root->base_relation_list_);
if (rel == NULL) if (rel == NULL)
{ {
rel = makeNode(Rel); rel = makeNode(RelOptInfo);
rel->relids = relids; rel->relids = relids;
rel->indexed = false; rel->indexed = false;
rel->pages = 0; rel->pages = 0;
@ -100,7 +100,7 @@ get_base_rel(Query *root, int relid)
* creating a new one if necessary. This is for join relations. * creating a new one if necessary. This is for join relations.
* *
*/ */
Rel * RelOptInfo *
get_join_rel(Query *root, List *relid) get_join_rel(Query *root, List *relid)
{ {
return rel_member(relid, root->join_relation_list_); return rel_member(relid, root->join_relation_list_);
@ -114,7 +114,7 @@ get_join_rel(Query *root, List *relid)
* Returns the corresponding entry in 'rels' if it is there. * Returns the corresponding entry in 'rels' if it is there.
* *
*/ */
Rel * RelOptInfo *
rel_member(List *relid, List *rels) rel_member(List *relid, List *rels)
{ {
List *temp = NIL; List *temp = NIL;
@ -124,9 +124,9 @@ rel_member(List *relid, List *rels)
{ {
foreach(temp, rels) foreach(temp, rels)
{ {
temprelid = ((Rel *) lfirst(temp))->relids; temprelid = ((RelOptInfo *) lfirst(temp))->relids;
if (same(temprelid, relid)) if (same(temprelid, relid))
return ((Rel *) (lfirst(temp))); return ((RelOptInfo *) (lfirst(temp)));
} }
} }
return (NULL); return (NULL);

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.13 1998/06/15 19:28:49 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.14 1998/07/18 04:22:41 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -93,7 +93,7 @@ matching_tlvar(Var *var, List *targetlist)
* CREATES: new var-node iff no matching var-node exists in targetlist * CREATES: new var-node iff no matching var-node exists in targetlist
*/ */
void void
add_tl_element(Rel *rel, Var *var) add_tl_element(RelOptInfo *rel, Var *var)
{ {
Expr *oldvar = (Expr *) NULL; Expr *oldvar = (Expr *) NULL;

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: nodes.h,v 1.24 1998/02/13 03:45:23 vadim Exp $ * $Id: nodes.h,v 1.25 1998/07/18 04:22:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -70,7 +70,7 @@ typedef enum NodeTag
* TAGS FOR INNER PLAN NODES (relation.h) * TAGS FOR INNER PLAN NODES (relation.h)
*--------------------- *---------------------
*/ */
T_Rel = 200, T_RelOptInfo = 200,
T_Path, T_Path,
T_IndexPath, T_IndexPath,
T_JoinPath, T_JoinPath,

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: relation.h,v 1.7 1997/09/08 21:53:01 momjian Exp $ * $Id: relation.h,v 1.8 1998/07/18 04:22:45 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -24,7 +24,7 @@
typedef List *Relid; typedef List *Relid;
/* /*
* Rel * RelOptInfo
* Per-base-relation information * Per-base-relation information
* *
* Parts of this data structure are specific to various scan and join * Parts of this data structure are specific to various scan and join
@ -47,7 +47,7 @@ typedef List *Relid;
* leaves the tuples unordered) * leaves the tuples unordered)
* cheapestpath - least expensive Path (regardless of final order) * cheapestpath - least expensive Path (regardless of final order)
* pruneable - flag to let the planner know whether it can prune the plan * pruneable - flag to let the planner know whether it can prune the plan
* space of this Rel or not. -- JMH, 11/11/92 * space of this RelOptInfo or not. -- JMH, 11/11/92
* *
* * If the relation is a (secondary) index it will have the following * * If the relation is a (secondary) index it will have the following
* three fields: * three fields:
@ -71,7 +71,7 @@ typedef List *Relid;
* is always 0. 2/95 - ay * is always 0. 2/95 - ay
*/ */
typedef struct Rel typedef struct RelOptInfo
{ {
NodeTag type; NodeTag type;
@ -106,7 +106,7 @@ typedef struct Rel
List *joininfo; /* join clauses */ List *joininfo; /* join clauses */
List *innerjoin; List *innerjoin;
List *superrels; List *superrels;
} Rel; } RelOptInfo;
extern Var *get_expr(TargetEntry *foo); extern Var *get_expr(TargetEntry *foo);
@ -139,7 +139,7 @@ typedef struct Path
{ {
NodeTag type; NodeTag type;
Rel *parent; RelOptInfo *parent;
Cost path_cost; Cost path_cost;
NodeTag pathtype; NodeTag pathtype;

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: cost.h,v 1.8 1998/02/26 04:42:14 momjian Exp $ * $Id: cost.h,v 1.9 1998/07/18 04:22:46 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -47,8 +47,8 @@ extern Cost
cost_hashjoin(Cost outercost, Cost innercost, List *outerkeys, cost_hashjoin(Cost outercost, Cost innercost, List *outerkeys,
List *innerkeys, int outersize, int innersize, List *innerkeys, int outersize, int innersize,
int outerwidth, int innerwidth); int outerwidth, int innerwidth);
extern int compute_rel_size(Rel *rel); extern int compute_rel_size(RelOptInfo *rel);
extern int compute_rel_width(Rel *rel); extern int compute_rel_width(RelOptInfo *rel);
extern int compute_joinrel_size(JoinPath *joinpath); extern int compute_joinrel_size(JoinPath *joinpath);
extern int page_size(int tuples, int width); extern int page_size(int tuples, int width);

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo.h,v 1.7 1997/11/26 01:13:23 momjian Exp $ * $Id: geqo.h,v 1.8 1998/07/18 04:22:50 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -70,13 +70,13 @@ double SelectionBias;
/* ^^^ */ /* ^^^ */
/* geqo prototypes */ /* geqo prototypes */
extern Rel *geqo(Query *root); extern RelOptInfo *geqo(Query *root);
extern void geqo_params(int string_length); extern void geqo_params(int string_length);
extern Cost geqo_eval(Query *root, Gene *tour, int num_gene); extern Cost geqo_eval(Query *root, Gene *tour, int num_gene);
double geqo_log(double x, double b); double geqo_log(double x, double b);
extern Rel *gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel); extern RelOptInfo *gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *outer_rel);
#endif /* GEQO_H */ #endif /* GEQO_H */

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo_misc.h,v 1.5 1997/11/26 01:13:28 momjian Exp $ * $Id: geqo_misc.h,v 1.6 1998/07/18 04:22:50 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -31,7 +31,7 @@ extern void print_pool(FILE *fp, Pool *pool, int start, int stop);
extern void print_gen(FILE *fp, Pool *pool, int generation); extern void print_gen(FILE *fp, Pool *pool, int generation);
extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene); extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene);
extern void geqo_print_rel(Query *root, Rel *rel); extern void geqo_print_rel(Query *root, RelOptInfo *rel);
extern void geqo_print_path(Query *root, Path *path, int indent); extern void geqo_print_path(Query *root, Path *path, int indent);
extern void geqo_print_joinclauses(Query *root, List *clauses); extern void geqo_print_joinclauses(Query *root, List *clauses);

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: geqo_paths.h,v 1.4 1997/09/08 21:53:14 momjian Exp $ * $Id: geqo_paths.h,v 1.5 1998/07/18 04:22:50 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -23,6 +23,6 @@
extern List *geqo_prune_rels(List *rel_list); extern List *geqo_prune_rels(List *rel_list);
extern void geqo_rel_paths(Rel *rel); extern void geqo_rel_paths(RelOptInfo *rel);
#endif /* GEQO_PATHS_H */ #endif /* GEQO_PATHS_H */

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: joininfo.h,v 1.5 1997/11/26 01:13:39 momjian Exp $ * $Id: joininfo.h,v 1.6 1998/07/18 04:22:51 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -18,7 +18,7 @@
#include "nodes/primnodes.h" #include "nodes/primnodes.h"
extern JInfo *joininfo_member(List *join_relids, List *joininfo_list); extern JInfo *joininfo_member(List *join_relids, List *joininfo_list);
extern JInfo *find_joininfo_node(Rel *this_rel, List *join_relids); extern JInfo *find_joininfo_node(RelOptInfo *this_rel, List *join_relids);
extern Var *other_join_clause_var(Var *var, Expr *clause); extern Var *other_join_clause_var(Var *var, Expr *clause);
#endif /* JOININFO_H */ #endif /* JOININFO_H */

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: keys.h,v 1.6 1997/11/26 01:13:41 momjian Exp $ * $Id: keys.h,v 1.7 1998/07/18 04:22:51 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -16,7 +16,7 @@
#include "nodes/nodes.h" #include "nodes/nodes.h"
#include "nodes/relation.h" #include "nodes/relation.h"
extern bool match_indexkey_operand(int indexkey, Var *operand, Rel *rel); extern bool match_indexkey_operand(int indexkey, Var *operand, RelOptInfo *rel);
extern Var *extract_subkey(JoinKey *jk, int which_subkey); extern Var *extract_subkey(JoinKey *jk, int which_subkey);
extern bool samekeys(List *keys1, List *keys2); extern bool samekeys(List *keys1, List *keys2);
extern List *collect_index_pathkeys(int *index_keys, List *tlist); extern List *collect_index_pathkeys(int *index_keys, List *tlist);

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pathnode.h,v 1.7 1998/02/26 04:42:16 momjian Exp $ * $Id: pathnode.h,v 1.8 1998/07/18 04:22:51 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -21,25 +21,25 @@
* prototypes for pathnode.c * prototypes for pathnode.c
*/ */
extern bool path_is_cheaper(Path *path1, Path *path2); extern bool path_is_cheaper(Path *path1, Path *path2);
extern Path *set_cheapest(Rel *parent_rel, List *pathlist); extern Path *set_cheapest(RelOptInfo *parent_rel, List *pathlist);
extern List * extern List *
add_pathlist(Rel *parent_rel, List *unique_paths, add_pathlist(RelOptInfo *parent_rel, List *unique_paths,
List *new_paths); List *new_paths);
extern Path *create_seqscan_path(Rel *rel); extern Path *create_seqscan_path(RelOptInfo *rel);
extern IndexPath * extern IndexPath *
create_index_path(Query *root, Rel *rel, Rel *index, create_index_path(Query *root, RelOptInfo *rel, RelOptInfo *index,
List *restriction_clauses, bool is_join_scan); List *restriction_clauses, bool is_join_scan);
extern JoinPath * extern JoinPath *
create_nestloop_path(Rel *joinrel, Rel *outer_rel, create_nestloop_path(RelOptInfo *joinrel, RelOptInfo *outer_rel,
Path *outer_path, Path *inner_path, List *keys); Path *outer_path, Path *inner_path, List *keys);
extern MergePath * extern MergePath *
create_mergesort_path(Rel *joinrel, int outersize, create_mergesort_path(RelOptInfo *joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path *outer_path, int innersize, int outerwidth, int innerwidth, Path *outer_path,
Path *inner_path, List *keys, MergeOrder *order, Path *inner_path, List *keys, MergeOrder *order,
List *mergeclauses, List *outersortkeys, List *innersortkeys); List *mergeclauses, List *outersortkeys, List *innersortkeys);
extern HashPath * extern HashPath *
create_hashjoin_path(Rel *joinrel, int outersize, create_hashjoin_path(RelOptInfo *joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path *outer_path, int innersize, int outerwidth, int innerwidth, Path *outer_path,
Path *inner_path, List *keys, Oid operator, List *hashclauses, Path *inner_path, List *keys, Oid operator, List *hashclauses,
List *outerkeys, List *innerkeys); List *outerkeys, List *innerkeys);
@ -47,13 +47,13 @@ create_hashjoin_path(Rel *joinrel, int outersize,
/* /*
* prototypes for rel.c * prototypes for rel.c
*/ */
extern Rel *rel_member(List *relid, List *rels); extern RelOptInfo *rel_member(List *relid, List *rels);
extern Rel *get_base_rel(Query *root, int relid); extern RelOptInfo *get_base_rel(Query *root, int relid);
extern Rel *get_join_rel(Query *root, List *relid); extern RelOptInfo *get_join_rel(Query *root, List *relid);
/* /*
* prototypes for indexnode.h * prototypes for indexnode.h
*/ */
extern List *find_relation_indices(Query *root, Rel *rel); extern List *find_relation_indices(Query *root, RelOptInfo *rel);
#endif /* PATHNODE_H */ #endif /* PATHNODE_H */

View File

@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: paths.h,v 1.8 1998/02/26 04:42:17 momjian Exp $ * $Id: paths.h,v 1.9 1998/07/18 04:22:51 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -28,7 +28,7 @@ extern List *find_paths(Query *root, List *rels);
* routines to generate index paths * routines to generate index paths
*/ */
extern List * extern List *
find_index_paths(Query *root, Rel *rel, List *indices, find_index_paths(Query *root, RelOptInfo *rel, List *indices,
List *clauseinfo_list, List *clauseinfo_list,
List *joininfo_list); List *joininfo_list);
@ -42,7 +42,7 @@ extern void find_all_join_paths(Query *root, List *joinrels);
/* /*
* orindxpath.h * orindxpath.h
*/ */
extern List *create_or_index_paths(Query *root, Rel *rel, List *clauses); extern List *create_or_index_paths(Query *root, RelOptInfo *rel, List *clauses);
/* /*
* hashutils.h * hashutils.h
@ -94,7 +94,7 @@ extern List *final_join_rels(List *join_rel_list);
*/ */
extern void prune_joinrels(List *rel_list); extern void prune_joinrels(List *rel_list);
extern void prune_rel_paths(List *rel_list); extern void prune_rel_paths(List *rel_list);
extern Path *prune_rel_path(Rel *rel, Path *unorderedpath); extern Path *prune_rel_path(RelOptInfo *rel, Path *unorderedpath);
extern List *merge_joinrels(List *rel_list1, List *rel_list2); extern List *merge_joinrels(List *rel_list1, List *rel_list2);
extern List *prune_oldrels(List *old_rels); extern List *prune_oldrels(List *old_rels);

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: tlist.h,v 1.8 1998/02/26 04:42:31 momjian Exp $ * $Id: tlist.h,v 1.9 1998/07/18 04:22:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -20,7 +20,7 @@
extern int exec_tlist_length(List *targelist); extern int exec_tlist_length(List *targelist);
extern TargetEntry *tlistentry_member(Var *var, List *targetlist); extern TargetEntry *tlistentry_member(Var *var, List *targetlist);
extern Expr *matching_tlvar(Var *var, List *targetlist); extern Expr *matching_tlvar(Var *var, List *targetlist);
extern void add_tl_element(Rel *rel, Var *var); extern void add_tl_element(RelOptInfo *rel, Var *var);
extern TargetEntry *create_tl_element(Var *var, int resdomno); extern TargetEntry *create_tl_element(Var *var, int resdomno);
extern List *get_actual_tlist(List *tlist); extern List *get_actual_tlist(List *tlist);
extern Resdom *tlist_member(Var *var, List *tlist); extern Resdom *tlist_member(Var *var, List *tlist);

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: xfunc.h,v 1.7 1998/02/26 04:42:33 momjian Exp $ * $Id: xfunc.h,v 1.8 1998/07/18 04:22:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -49,7 +49,7 @@ extern int XfuncMode; /* defined in tcop/postgres.c */
#define is_join(pathnode) (length(get_relids(get_parent(pathnode))) > 1 ? 1 : 0) #define is_join(pathnode) (length(get_relids(get_parent(pathnode))) > 1 ? 1 : 0)
/* function prototypes from planner/path/xfunc.c */ /* function prototypes from planner/path/xfunc.c */
extern void xfunc_trypullup(Rel *rel); extern void xfunc_trypullup(RelOptInfo *rel);
extern int extern int
xfunc_shouldpull(Path *childpath, JoinPath *parentpath, xfunc_shouldpull(Path *childpath, JoinPath *parentpath,
int whichchild, CInfo *maxcinfopt); int whichchild, CInfo *maxcinfopt);
@ -71,7 +71,7 @@ extern List *xfunc_primary_join(JoinPath *pathnode);
extern Cost xfunc_get_path_cost(Path *pathnode); extern Cost xfunc_get_path_cost(Path *pathnode);
extern Cost xfunc_total_path_cost(JoinPath *pathnode); extern Cost xfunc_total_path_cost(JoinPath *pathnode);
extern Cost xfunc_expense_per_tuple(JoinPath *joinnode, int whichchild); extern Cost xfunc_expense_per_tuple(JoinPath *joinnode, int whichchild);
extern void xfunc_fixvars(Expr *clause, Rel *rel, int varno); extern void xfunc_fixvars(Expr *clause, RelOptInfo *rel, int varno);
extern int xfunc_cinfo_compare(void *arg1, void *arg2); extern int xfunc_cinfo_compare(void *arg1, void *arg2);
extern int xfunc_clause_compare(void *arg1, void *arg2); extern int xfunc_clause_compare(void *arg1, void *arg2);
extern void xfunc_disjunct_sort(List *clause_list); extern void xfunc_disjunct_sort(List *clause_list);
@ -80,7 +80,7 @@ extern int xfunc_func_width(RegProcedure funcid, List *args);
extern int xfunc_tuple_width(Relation rd); extern int xfunc_tuple_width(Relation rd);
extern int xfunc_num_join_clauses(JoinPath *path); extern int xfunc_num_join_clauses(JoinPath *path);
extern List *xfunc_LispRemove(List *foo, List *bar); extern List *xfunc_LispRemove(List *foo, List *bar);
extern bool xfunc_copyrel(Rel *from, Rel **to); extern bool xfunc_copyrel(RelOptInfo *from, RelOptInfo **to);
/* /*
* function prototypes for path/predmig.c * function prototypes for path/predmig.c