1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

OK, folks, here is the pgindent output.

This commit is contained in:
Bruce Momjian
1998-09-01 04:40:42 +00:00
parent af74855a60
commit fa1a8d6a97
574 changed files with 26509 additions and 24033 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.22 1998/09/01 03:23:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.23 1998/09/01 04:29:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,8 +45,10 @@ int32 _use_geqo_rels_ = GEQO_RELS;
static void find_rel_paths(Query *root, List *rels);
static List *find_join_paths(Query *root, List *outer_rels, int levels_needed);
#ifdef OPTIMIZER_DEBUG
static void debug_print_rel(Query *root, RelOptInfo *rel);
static void debug_print_rel(Query *root, RelOptInfo * rel);
#endif
/*
@@ -76,6 +78,7 @@ find_paths(Query *root, List *rels)
if (levels_needed <= 1)
{
/*
* Unsorted single relation, no more processing is required.
*/
@@ -83,6 +86,7 @@ find_paths(Query *root, List *rels)
}
else
{
/*
* this means that joins or sorts are required. set selectivities
* of clauses that have not been set by an index.
@@ -118,10 +122,10 @@ find_rel_paths(Query *root, List *rels)
sequential_scan_list = lcons(create_seqscan_path(rel), NIL);
rel_index_scan_list = find_index_paths(root,
rel,
find_relation_indices(root, rel),
rel->clauseinfo,
rel->joininfo);
rel,
find_relation_indices(root, rel),
rel->clauseinfo,
rel->joininfo);
or_index_scan_list = create_or_index_paths(root, rel, rel->clauseinfo);
@@ -180,7 +184,8 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*******************************************/
if ((_use_geqo_) && length(root->base_rel_list) >= _use_geqo_rels_)
return lcons(geqo(root), NIL); /* returns *one* RelOptInfo, so lcons it */
return lcons(geqo(root), NIL); /* returns *one* RelOptInfo, so
* lcons it */
/*******************************************
* rest will be deprecated in case of GEQO *
@@ -280,7 +285,7 @@ print_joinclauses(Query *root, List *clauses)
foreach(l, clauses)
{
ClauseInfo *c = lfirst(l);
ClauseInfo *c = lfirst(l);
print_expr((Node *) c->clause, root->rtable);
if (lnext(l))
@@ -396,7 +401,7 @@ print_path(Query *root, Path *path, int indent)
}
static void
debug_print_rel(Query *root, RelOptInfo *rel)
debug_print_rel(Query *root, RelOptInfo * rel)
{
List *l;
@@ -412,4 +417,4 @@ debug_print_rel(Query *root, RelOptInfo *rel)
print_path(root, rel->cheapestpath, 1);
}
#endif /* OPTIMIZER_DEBUG */
#endif /* OPTIMIZER_DEBUG */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.12 1998/09/01 03:23:19 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.13 1998/09/01 04:29:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@ void
set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
{
List *temp;
ClauseInfo *clausenode;
ClauseInfo *clausenode;
Cost cost_clause;
foreach(temp, clauseinfo_list)
@@ -95,7 +95,7 @@ product_selec(List *clauseinfo_list)
void
set_rest_relselec(Query *root, List *rel_list)
{
RelOptInfo *rel;
RelOptInfo *rel;
List *x;
foreach(x, rel_list)
@@ -117,7 +117,7 @@ void
set_rest_selec(Query *root, List *clauseinfo_list)
{
List *temp = NIL;
ClauseInfo *clausenode = (ClauseInfo *) NULL;
ClauseInfo *clausenode = (ClauseInfo *) NULL;
Cost cost_clause;
foreach(temp, clauseinfo_list)
@@ -159,8 +159,8 @@ set_rest_selec(Query *root, List *clauseinfo_list)
Cost
compute_clause_selec(Query *root, Node *clause, List *or_selectivities)
{
if (is_opclause(clause))
return compute_selec(root, lcons(clause,NIL), or_selectivities);
if (is_opclause(clause))
return compute_selec(root, lcons(clause, NIL), or_selectivities);
else if (not_clause(clause))
{
@@ -182,9 +182,7 @@ compute_clause_selec(Query *root, Node *clause, List *or_selectivities)
return compute_selec(root, ((Expr *) clause)->args, or_selectivities);
}
else
{
return compute_selec(root, lcons(clause, NIL), or_selectivities);
}
}
/*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.24 1998/09/01 03:23:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.25 1998/09/01 04:29:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -360,7 +360,7 @@ cost_hashjoin(Cost outercost,
* Returns the size.
*/
int
compute_rel_size(RelOptInfo *rel)
compute_rel_size(RelOptInfo * rel)
{
Cost temp;
int temp1;
@@ -383,7 +383,7 @@ compute_rel_size(RelOptInfo *rel)
* Returns the width of the tuple as a fixnum.
*/
int
compute_rel_width(RelOptInfo *rel)
compute_rel_width(RelOptInfo * rel)
{
return compute_targetlist_width(get_actual_tlist(rel->targetlist));
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.6 1998/09/01 03:23:22 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.7 1998/09/01 04:29:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@ group_clauses_by_hashop(List *clauseinfo_list,
int inner_relid)
{
List *hashinfo_list = NIL;
ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
List *i = NIL;
Oid hashjoinop = 0;
@@ -121,7 +121,7 @@ match_hashop_hashinfo(Oid hashop, List *hashinfo_list)
key = xhashinfo->hashop;
if (hashop == key)
{ /* found */
return xhashinfo; /* should be a hashinfo node ! */
return xhashinfo; /* should be a hashinfo node ! */
}
}
return (HInfo *) NIL;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.33 1998/09/01 03:23:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.34 1998/09/01 04:29:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,46 +41,36 @@
#include "parser/parsetree.h" /* for getrelid() */
#include "parser/parse_expr.h" /* for exprType() */
#include "parser/parse_oper.h" /* for oprid() and oper() */
#include "parser/parse_coerce.h" /* for IS_BINARY_COMPATIBLE() */
#include "parser/parse_coerce.h"/* for IS_BINARY_COMPATIBLE() */
#include "utils/lsyscache.h"
static void
match_index_orclauses(RelOptInfo *rel, RelOptInfo *index, int indexkey,
static void match_index_orclauses(RelOptInfo * rel, RelOptInfo * index, int indexkey,
int xclass, List *clauseinfo_list);
static bool
match_index_to_operand(int indexkey, Expr *operand,
RelOptInfo *rel, RelOptInfo *index);
static List *
match_index_orclause(RelOptInfo *rel, RelOptInfo *index, int indexkey,
static bool match_index_to_operand(int indexkey, Expr *operand,
RelOptInfo * rel, RelOptInfo * index);
static List *match_index_orclause(RelOptInfo * rel, RelOptInfo * index, int indexkey,
int xclass, List *or_clauses, List *other_matching_indices);
static List *
group_clauses_by_indexkey(RelOptInfo *rel, RelOptInfo *index,
static List *group_clauses_by_indexkey(RelOptInfo * rel, RelOptInfo * index,
int *indexkeys, Oid *classes, List *clauseinfo_list);
static List *
group_clauses_by_ikey_for_joins(RelOptInfo *rel, RelOptInfo *index,
static List *group_clauses_by_ikey_for_joins(RelOptInfo * rel, RelOptInfo * index,
int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list);
static ClauseInfo *
match_clause_to_indexkey(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, ClauseInfo *clauseInfo, bool join);
static bool
pred_test(List *predicate_list, List *clauseinfo_list,
static ClauseInfo *match_clause_to_indexkey(RelOptInfo * rel, RelOptInfo * index, int indexkey,
int xclass, ClauseInfo * clauseInfo, bool join);
static bool pred_test(List *predicate_list, List *clauseinfo_list,
List *joininfo_list);
static bool one_pred_test(Expr *predicate, List *clauseinfo_list);
static bool one_pred_clause_expr_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 List *
indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
static List *indexable_joinclauses(RelOptInfo * rel, RelOptInfo * index,
List *joininfo_list, List *clauseinfo_list);
static List *
index_innerjoin(Query *root, RelOptInfo *rel,
List *clausegroup_list, RelOptInfo *index);
static List *
create_index_paths(Query *root, RelOptInfo *rel, RelOptInfo *index,
static List *index_innerjoin(Query *root, RelOptInfo * rel,
List *clausegroup_list, RelOptInfo * index);
static List *create_index_paths(Query *root, RelOptInfo * rel, RelOptInfo * index,
List *clausegroup_list, bool join);
static List *add_index_paths(List *indexpaths, List *new_indexpaths);
static bool function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index);
static bool function_index_operand(Expr *funcOpnd, RelOptInfo * rel, RelOptInfo * index);
/* find_index_paths()
@@ -110,14 +100,14 @@ static bool function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *
*/
List *
find_index_paths(Query *root,
RelOptInfo *rel,
RelOptInfo * rel,
List *indices,
List *clauseinfo_list,
List *joininfo_list)
{
List *scanclausegroups = NIL;
List *scanpaths = NIL;
RelOptInfo *index = (RelOptInfo *) NULL;
RelOptInfo *index = (RelOptInfo *) NULL;
List *joinclausegroups = NIL;
List *joinpaths = NIL;
List *retval = NIL;
@@ -127,7 +117,10 @@ find_index_paths(Query *root,
{
index = (RelOptInfo *) lfirst(ilist);
/* If this is a partial index, return if it fails the predicate test */
/*
* If this is a partial index, return if it fails the predicate
* test
*/
if (index->indpred != NIL)
if (!pred_test(index->indpred, clauseinfo_list, joininfo_list))
continue;
@@ -136,20 +129,20 @@ find_index_paths(Query *root,
* 1. Try matching the index against subclauses of an 'or' clause.
* The fields of the clauseinfo nodes are marked with lists of the
* matching indices. No path are actually created. We currently
* only look to match the first key. We don't find multi-key index
* cases where an AND matches the first key, and the OR matches the
* second key.
* only look to match the first key. We don't find multi-key
* index cases where an AND matches the first key, and the OR
* matches the second key.
*/
match_index_orclauses(rel,
index,
index->indexkeys[0],
index->classlist[0],
clauseinfo_list);
index,
index->indexkeys[0],
index->classlist[0],
clauseinfo_list);
/*
* 2. If the keys of this index match any of the available restriction
* clauses, then create pathnodes corresponding to each group of
* usable clauses.
* 2. If the keys of this index match any of the available
* restriction clauses, then create pathnodes corresponding to
* each group of usable clauses.
*/
scanclausegroups = group_clauses_by_indexkey(rel,
index,
@@ -167,10 +160,10 @@ find_index_paths(Query *root,
/*
* 3. If this index can be used with any join clause, then create
* pathnodes for each group of usable clauses. An index can be used
* with a join clause if its ordering is useful for a mergejoin, or if
* the index can possibly be used for scanning the inner relation of a
* nestloop join.
* pathnodes for each group of usable clauses. An index can be
* used with a join clause if its ordering is useful for a
* mergejoin, or if the index can possibly be used for scanning
* the inner relation of a nestloop join.
*/
joinclausegroups = indexable_joinclauses(rel, index, joininfo_list, clauseinfo_list);
joinpaths = NIL;
@@ -179,7 +172,7 @@ find_index_paths(Query *root,
{
List *new_join_paths = create_index_paths(root, rel,
index,
joinclausegroups,
joinclausegroups,
true);
List *innerjoin_paths = index_innerjoin(root, rel, joinclausegroups, index);
@@ -225,13 +218,13 @@ find_index_paths(Query *root,
*
*/
static void
match_index_orclauses(RelOptInfo *rel,
RelOptInfo *index,
match_index_orclauses(RelOptInfo * rel,
RelOptInfo * index,
int indexkey,
int xclass,
List *clauseinfo_list)
{
ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
List *i = NIL;
foreach(i, clauseinfo_list)
@@ -262,10 +255,10 @@ match_index_orclauses(RelOptInfo *rel,
static bool
match_index_to_operand(int indexkey,
Expr *operand,
RelOptInfo *rel,
RelOptInfo *index)
RelOptInfo * rel,
RelOptInfo * index)
{
bool result;
bool result;
/*
* Normal index.
@@ -305,8 +298,8 @@ match_index_to_operand(int indexkey,
* match the third, g,h match the fourth, etc.
*/
static List *
match_index_orclause(RelOptInfo *rel,
RelOptInfo *index,
match_index_orclause(RelOptInfo * rel,
RelOptInfo * index,
int indexkey,
int xclass,
List *or_clauses,
@@ -323,30 +316,29 @@ match_index_orclause(RelOptInfo *rel,
foreach(clist, or_clauses)
matching_indices = lcons(NIL, matching_indices);
}
else matching_indices = other_matching_indices;
else
matching_indices = other_matching_indices;
index_list = matching_indices;
foreach(clist, or_clauses)
{
clause = lfirst(clist);
if (is_opclause(clause) &&
op_class(((Oper *) ((Expr *) clause)->oper)->opno,
xclass, index->relam) &&
((match_index_to_operand(indexkey,
(Expr *) get_leftop((Expr *) clause),
rel,
index) &&
(Expr *) get_leftop((Expr *) clause),
rel,
index) &&
IsA(get_rightop((Expr *) clause), Const)) ||
(match_index_to_operand(indexkey,
(Expr *) get_rightop((Expr *) clause),
rel,
index) &&
IsA(get_leftop((Expr *) clause), Const))))
{
rel,
index) &&
IsA(get_leftop((Expr *) clause), Const))))
lfirst(matching_indices) = lcons(index, lfirst(matching_indices));
}
matching_indices = lnext(matching_indices);
}
@@ -396,14 +388,14 @@ match_index_orclause(RelOptInfo *rel,
*
*/
static List *
group_clauses_by_indexkey(RelOptInfo *rel,
RelOptInfo *index,
group_clauses_by_indexkey(RelOptInfo * rel,
RelOptInfo * index,
int *indexkeys,
Oid *classes,
List *clauseinfo_list)
{
List *curCinfo = NIL;
ClauseInfo *matched_clause = (ClauseInfo *) NULL;
ClauseInfo *matched_clause = (ClauseInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
@@ -420,7 +412,7 @@ group_clauses_by_indexkey(RelOptInfo *rel,
foreach(curCinfo, clauseinfo_list)
{
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@@ -458,15 +450,15 @@ group_clauses_by_indexkey(RelOptInfo *rel,
*
*/
static List *
group_clauses_by_ikey_for_joins(RelOptInfo *rel,
RelOptInfo *index,
group_clauses_by_ikey_for_joins(RelOptInfo * rel,
RelOptInfo * index,
int *indexkeys,
Oid *classes,
List *join_cinfo_list,
List *restr_cinfo_list)
{
List *curCinfo = NIL;
ClauseInfo *matched_clause = (ClauseInfo *) NULL;
ClauseInfo *matched_clause = (ClauseInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
@@ -484,7 +476,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
foreach(curCinfo, join_cinfo_list)
{
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@@ -500,7 +492,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
}
foreach(curCinfo, restr_cinfo_list)
{
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@@ -580,11 +572,11 @@ group_clauses_by_ikey_for_joins(RelOptInfo *rel,
*
*/
static ClauseInfo *
match_clause_to_indexkey(RelOptInfo *rel,
RelOptInfo *index,
match_clause_to_indexkey(RelOptInfo * rel,
RelOptInfo * index,
int indexkey,
int xclass,
ClauseInfo *clauseInfo,
ClauseInfo * clauseInfo,
bool join)
{
Expr *clause = clauseInfo->clause;
@@ -607,6 +599,7 @@ match_clause_to_indexkey(RelOptInfo *rel,
*/
if (!join)
{
/*
* Check for standard s-argable clause
*/
@@ -622,24 +615,28 @@ match_clause_to_indexkey(RelOptInfo *rel,
index));
#ifndef IGNORE_BINARY_COMPATIBLE_INDICES
/* Didn't find an index?
* Then maybe we can find another binary-compatible index instead...
* thomas 1998-08-14
/*
* Didn't find an index? Then maybe we can find another
* binary-compatible index instead... thomas 1998-08-14
*/
if (! isIndexable)
if (!isIndexable)
{
Oid ltype;
Oid rtype;
Oid ltype;
Oid rtype;
ltype = exprType((Node *)leftop);
rtype = exprType((Node *)rightop);
ltype = exprType((Node *) leftop);
rtype = exprType((Node *) rightop);
/* make sure we have two different binary-compatible types... */
/*
* make sure we have two different binary-compatible
* types...
*/
if ((ltype != rtype)
&& IS_BINARY_COMPATIBLE(ltype, rtype))
&& IS_BINARY_COMPATIBLE(ltype, rtype))
{
char *opname;
Operator newop;
char *opname;
Operator newop;
opname = get_opname(restrict_op);
if (opname != NULL)
@@ -660,9 +657,7 @@ match_clause_to_indexkey(RelOptInfo *rel,
index));
if (isIndexable)
{
((Oper *) ((Expr *) clause)->oper)->opno = restrict_op;
}
}
}
}
@@ -679,24 +674,24 @@ match_clause_to_indexkey(RelOptInfo *rel,
get_commutator(((Oper *) ((Expr *) clause)->oper)->opno);
isIndexable = ((restrict_op != InvalidOid) &&
op_class(restrict_op, xclass, index->relam) &&
IndexScanableOperand(rightop,
indexkey, rel, index));
op_class(restrict_op, xclass, index->relam) &&
IndexScanableOperand(rightop,
indexkey, rel, index));
#ifndef IGNORE_BINARY_COMPATIBLE_INDICES
if (! isIndexable)
if (!isIndexable)
{
Oid ltype;
Oid rtype;
Oid ltype;
Oid rtype;
ltype = exprType((Node *)leftop);
rtype = exprType((Node *)rightop);
ltype = exprType((Node *) leftop);
rtype = exprType((Node *) rightop);
if ((ltype != rtype)
&& IS_BINARY_COMPATIBLE(ltype, rtype))
&& IS_BINARY_COMPATIBLE(ltype, rtype))
{
char *opname;
Operator newop;
char *opname;
Operator newop;
restrict_op = ((Oper *) ((Expr *) clause)->oper)->opno;
@@ -712,16 +707,14 @@ match_clause_to_indexkey(RelOptInfo *rel,
get_commutator(oprid(newop));
isIndexable = ((restrict_op != InvalidOid) &&
op_class(restrict_op, xclass, index->relam) &&
IndexScanableOperand(rightop,
indexkey,
rel,
index));
op_class(restrict_op, xclass, index->relam) &&
IndexScanableOperand(rightop,
indexkey,
rel,
index));
if (isIndexable)
{
((Oper *) ((Expr *) clause)->oper)->opno = oprid(newop);
}
}
}
}
@@ -729,6 +722,7 @@ match_clause_to_indexkey(RelOptInfo *rel,
if (isIndexable)
{
/*
* In place list modification. (op const var/func) -> (op
* var/func const)
@@ -848,7 +842,7 @@ pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list)
static bool
one_pred_test(Expr *predicate, List *clauseinfo_list)
{
ClauseInfo *clauseinfo;
ClauseInfo *clauseinfo;
List *item;
Assert(predicate != NULL);
@@ -1152,7 +1146,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
*/
test_oper = makeOper(test_op, /* opno */
InvalidOid, /* opid */
BOOLOID, /* opresulttype */
BOOLOID, /* opresulttype */
0, /* opsize */
NULL); /* op_fcache */
replace_opid(test_oper);
@@ -1163,7 +1157,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
#ifndef OMIT_PARTIAL_INDEX
test_result = ExecEvalExpr((Node *) test_expr, NULL, &isNull, NULL);
#endif /* OMIT_PARTIAL_INDEX */
#endif /* OMIT_PARTIAL_INDEX */
if (isNull)
{
elog(DEBUG, "clause_pred_clause_test: null test result");
@@ -1193,10 +1187,10 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
*
*/
static List *
indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
indexable_joinclauses(RelOptInfo * rel, RelOptInfo * index,
List *joininfo_list, List *clauseinfo_list)
{
JoinInfo *joininfo = (JoinInfo *) NULL;
JoinInfo *joininfo = (JoinInfo *) NULL;
List *cg_list = NIL;
List *i = NIL;
List *clausegroups = NIL;
@@ -1245,7 +1239,7 @@ extract_restrict_clauses(List *clausegroup)
foreach(l, clausegroup)
{
ClauseInfo *cinfo = lfirst(l);
ClauseInfo *cinfo = lfirst(l);
if (!is_joinable((Node *) cinfo->clause))
restrict_cls = lappend(restrict_cls, cinfo);
@@ -1267,8 +1261,8 @@ extract_restrict_clauses(List *clausegroup)
*
*/
static List *
index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list,
RelOptInfo *index)
index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list,
RelOptInfo * index)
{
List *clausegroup = NIL;
List *cg_list = NIL;
@@ -1354,8 +1348,8 @@ index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list,
*/
static List *
create_index_paths(Query *root,
RelOptInfo *rel,
RelOptInfo *index,
RelOptInfo * rel,
RelOptInfo * index,
List *clausegroup_list,
bool join)
{
@@ -1367,7 +1361,7 @@ create_index_paths(Query *root,
foreach(i, clausegroup_list)
{
ClauseInfo *clauseinfo;
ClauseInfo *clauseinfo;
List *temp_node = NIL;
bool temp = true;
@@ -1399,7 +1393,7 @@ add_index_paths(List *indexpaths, List *new_indexpaths)
}
static bool
function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index)
function_index_operand(Expr *funcOpnd, RelOptInfo * rel, RelOptInfo * index)
{
Oid heapRelid = (Oid) lfirsti(rel->relids);
Func *function;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.9 1998/09/01 03:23:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.10 1998/09/01 04:29:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,19 +30,15 @@
* _enable_mergejoin} */
static Path *best_innerjoin(List *join_paths, List *outer_relid);
static List *
sort_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
static List *sort_inner_and_outer(RelOptInfo * joinrel, RelOptInfo * outerrel, RelOptInfo * innerrel,
List *mergeinfo_list);
static List *
match_unsorted_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
static List *match_unsorted_outer(RelOptInfo * joinrel, RelOptInfo * outerrel, RelOptInfo * innerrel,
List *outerpath_list, Path *cheapest_inner, Path *best_innerjoin,
List *mergeinfo_list);
static List *
match_unsorted_inner(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
static List *match_unsorted_inner(RelOptInfo * joinrel, RelOptInfo * outerrel, RelOptInfo * innerrel,
List *innerpath_list, List *mergeinfo_list);
static bool EnoughMemoryForHashjoin(RelOptInfo *hashrel);
static List *
hash_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
static bool EnoughMemoryForHashjoin(RelOptInfo * hashrel);
static List *hash_inner_and_outer(RelOptInfo * joinrel, RelOptInfo * outerrel, RelOptInfo * innerrel,
List *hashinfo_list);
/*
@@ -76,11 +72,11 @@ find_all_join_paths(Query *root, List *joinrels)
while (joinrels != NIL)
{
RelOptInfo *joinrel = (RelOptInfo *) lfirst(joinrels);
RelOptInfo *joinrel = (RelOptInfo *) lfirst(joinrels);
List *innerrelids;
List *outerrelids;
RelOptInfo *innerrel;
RelOptInfo *outerrel;
RelOptInfo *innerrel;
RelOptInfo *outerrel;
Path *bestinnerjoin;
List *pathlist = NIL;
@@ -238,9 +234,9 @@ best_innerjoin(List *join_paths, List *outer_relids)
* Returns a list of mergejoin paths.
*/
static List *
sort_inner_and_outer(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
sort_inner_and_outer(RelOptInfo * joinrel,
RelOptInfo * outerrel,
RelOptInfo * innerrel,
List *mergeinfo_list)
{
List *ms_list = NIL;
@@ -316,9 +312,9 @@ sort_inner_and_outer(RelOptInfo *joinrel,
* Returns a list of possible join path nodes.
*/
static List *
match_unsorted_outer(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
match_unsorted_outer(RelOptInfo * joinrel,
RelOptInfo * outerrel,
RelOptInfo * innerrel,
List *outerpath_list,
Path *cheapest_inner,
Path *best_innerjoin,
@@ -469,9 +465,9 @@ match_unsorted_outer(RelOptInfo *joinrel,
* Returns a list of possible merge paths.
*/
static List *
match_unsorted_inner(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
match_unsorted_inner(RelOptInfo * joinrel,
RelOptInfo * outerrel,
RelOptInfo * innerrel,
List *innerpath_list,
List *mergeinfo_list)
{
@@ -565,7 +561,7 @@ match_unsorted_inner(RelOptInfo *joinrel,
}
static bool
EnoughMemoryForHashjoin(RelOptInfo *hashrel)
EnoughMemoryForHashjoin(RelOptInfo * hashrel)
{
int ntuples;
int tupsize;
@@ -599,9 +595,9 @@ EnoughMemoryForHashjoin(RelOptInfo *hashrel)
* Returns a list of hashjoin paths.
*/
static List *
hash_inner_and_outer(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
hash_inner_and_outer(RelOptInfo * joinrel,
RelOptInfo * outerrel,
RelOptInfo * innerrel,
List *hashinfo_list)
{
HInfo *xhashinfo = (HInfo *) NULL;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.14 1998/09/01 03:23:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.15 1998/09/01 04:29:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,19 +31,17 @@ bool _use_right_sided_plans_ = false;
#endif
static List *find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list);
static List *find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels);
static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo);
static List *
new_join_tlist(List *tlist, List *other_relids,
static List *find_clause_joins(Query *root, RelOptInfo * outer_rel, List *joininfo_list);
static List *find_clauseless_joins(RelOptInfo * outer_rel, List *inner_rels);
static RelOptInfo *init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininfo);
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 void add_superrels(RelOptInfo *rel, RelOptInfo *super_rel);
static bool nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2);
static void add_superrels(RelOptInfo * rel, RelOptInfo * super_rel);
static bool nonoverlap_rels(RelOptInfo * rel1, RelOptInfo * rel2);
static bool nonoverlap_sets(List *s1, List *s2);
static void
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel,
JoinInfo *jinfo);
static void set_joinrel_size(RelOptInfo * joinrel, RelOptInfo * outer_rel, RelOptInfo * inner_rel,
JoinInfo * jinfo);
/*
* find-join-rels--
@@ -67,7 +65,7 @@ find_join_rels(Query *root, List *outer_rels)
foreach(r, outer_rels)
{
RelOptInfo *outer_rel = (RelOptInfo *) lfirst(r);
RelOptInfo *outer_rel = (RelOptInfo *) lfirst(r);
if (!(joins = find_clause_joins(root, outer_rel, outer_rel->joininfo)))
{
@@ -99,15 +97,15 @@ find_join_rels(Query *root, List *outer_rels)
* Returns a list of new join relations.
*/
static List *
find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
find_clause_joins(Query *root, RelOptInfo * outer_rel, List *joininfo_list)
{
List *join_list = NIL;
List *i = NIL;
foreach(i, joininfo_list)
{
JoinInfo *joininfo = (JoinInfo *) lfirst(i);
RelOptInfo *rel;
JoinInfo *joininfo = (JoinInfo *) lfirst(i);
RelOptInfo *rel;
if (!joininfo->inactive)
{
@@ -158,9 +156,9 @@ find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
* Returns a list of new join relations.
*/
static List *
find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
find_clauseless_joins(RelOptInfo * outer_rel, List *inner_rels)
{
RelOptInfo *inner_rel;
RelOptInfo *inner_rel;
List *t_list = NIL;
List *temp_node = NIL;
List *i = NIL;
@@ -193,9 +191,9 @@ find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
* Returns the new join relation node.
*/
static RelOptInfo *
init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo)
init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininfo)
{
RelOptInfo *joinrel = makeNode(RelOptInfo);
RelOptInfo *joinrel = makeNode(RelOptInfo);
List *joinrel_joininfo_list = NIL;
List *new_outer_tlist;
List *new_inner_tlist;
@@ -327,13 +325,13 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
{
List *current_joininfo_list = NIL;
List *new_otherrels = NIL;
JoinInfo *other_joininfo = (JoinInfo *) NULL;
JoinInfo *other_joininfo = (JoinInfo *) NULL;
List *xjoininfo = NIL;
foreach(xjoininfo, joininfo_list)
{
List *or;
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
new_otherrels = joininfo->otherrels;
foreach(or, new_otherrels)
@@ -396,23 +394,23 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xjoinrel, joinrels)
{
RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids)
{
Relid relid = (Relid) lfirst(xrelid);
RelOptInfo *rel = get_join_rel(root, relid);
RelOptInfo *rel = get_join_rel(root, relid);
add_superrels(rel, joinrel);
}
}
foreach(xjoinrel, joinrels)
{
RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo)
{
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
List *other_rels = joininfo->otherrels;
List *clause_info = joininfo->jinfoclauseinfo;
bool mergejoinable = joininfo->mergejoinable;
@@ -421,10 +419,10 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xrelid, other_rels)
{
Relid relid = (Relid) lfirst(xrelid);
RelOptInfo *rel = get_join_rel(root, relid);
RelOptInfo *rel = get_join_rel(root, relid);
List *super_rels = rel->superrels;
List *xsuper_rel = NIL;
JoinInfo *new_joininfo = makeNode(JoinInfo);
JoinInfo *new_joininfo = makeNode(JoinInfo);
new_joininfo->otherrels = joinrel->relids;
new_joininfo->jinfoclauseinfo = clause_info;
@@ -436,12 +434,12 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xsuper_rel, super_rels)
{
RelOptInfo *super_rel = (RelOptInfo *) lfirst(xsuper_rel);
RelOptInfo *super_rel = (RelOptInfo *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel))
{
List *new_relids = super_rel->relids;
JoinInfo *other_joininfo =
JoinInfo *other_joininfo =
joininfo_member(new_relids,
joinrel->joininfo);
@@ -453,7 +451,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
else
{
JoinInfo *new_joininfo = makeNode(JoinInfo);
JoinInfo *new_joininfo = makeNode(JoinInfo);
new_joininfo->otherrels = new_relids;
new_joininfo->jinfoclauseinfo = clause_info;
@@ -471,7 +469,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
foreach(xrel, outerrels)
{
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
rel->superrels = NIL;
}
@@ -499,13 +497,13 @@ final_join_rels(List *join_rel_list)
*/
foreach(xrel, join_rel_list)
{
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
List *xjoininfo = NIL;
bool final = true;
foreach(xjoininfo, rel->joininfo)
{
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
if (joininfo->otherrels != NIL)
{
@@ -533,7 +531,7 @@ final_join_rels(List *join_rel_list)
* Modifies the superrels field of rel
*/
static void
add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
add_superrels(RelOptInfo * rel, RelOptInfo * super_rel)
{
rel->superrels = lappend(rel->superrels, super_rel);
}
@@ -548,7 +546,7 @@ add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
* Returns non-nil if rel1 and rel2 do not overlap.
*/
static bool
nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
nonoverlap_rels(RelOptInfo * rel1, RelOptInfo * rel2)
{
return nonoverlap_sets(rel1->relids, rel2->relids);
}
@@ -569,7 +567,7 @@ nonoverlap_sets(List *s1, List *s2)
}
static void
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *jinfo)
set_joinrel_size(RelOptInfo * joinrel, RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * jinfo)
{
int ntuples;
float selec;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.7 1998/09/01 03:23:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.8 1998/09/01 04:29:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,18 +26,14 @@
#include "optimizer/ordering.h"
static int
match_pathkey_joinkeys(List *pathkey, List *joinkeys,
static int match_pathkey_joinkeys(List *pathkey, List *joinkeys,
int which_subkey);
static bool
every_func(List *joinkeys, List *pathkey,
static bool every_func(List *joinkeys, List *pathkey,
int which_subkey);
static List *
new_join_pathkey(List *subkeys,
static List *new_join_pathkey(List *subkeys,
List *considered_subkeys, List *join_rel_tlist,
List *joinclauses);
static List *
new_matching_subkeys(Var *subkey, List *considered_subkeys,
static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
List *join_rel_tlist, List *joinclauses);
/****************************************************************************
@@ -146,7 +142,7 @@ match_pathkey_joinkeys(List *pathkey,
pos++;
}
}
return -1; /* no index found */
return -1; /* no index found */
}
/*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.8 1998/09/01 03:23:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.9 1998/09/01 04:29:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,7 @@ group_clauses_by_order(List *clauseinfo_list,
foreach(xclauseinfo, clauseinfo_list)
{
ClauseInfo *clauseinfo = (ClauseInfo *) lfirst(xclauseinfo);
ClauseInfo *clauseinfo = (ClauseInfo *) lfirst(xclauseinfo);
MergeOrder *merge_ordering = clauseinfo->mergejoinorder;
if (merge_ordering)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.10 1998/09/01 03:23:29 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.11 1998/09/01 04:29:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,11 +32,10 @@
static void
best_or_subclause_indices(Query *root, RelOptInfo *rel, List *subclauses,
best_or_subclause_indices(Query *root, RelOptInfo * rel, List *subclauses,
List *indices, List *examined_indexids, Cost subcost, List *selectivities,
List **indexids, Cost *cost, List **selecs);
static void
best_or_subclause_index(Query *root, RelOptInfo *rel, Expr *subclause,
static void best_or_subclause_index(Query *root, RelOptInfo * rel, Expr *subclause,
List *indices, int *indexid, Cost *cost, Cost *selec);
@@ -52,14 +51,14 @@ best_or_subclause_index(Query *root, RelOptInfo *rel, Expr *subclause,
*/
List *
create_or_index_paths(Query *root,
RelOptInfo *rel, List *clauses)
RelOptInfo * rel, List *clauses)
{
List *t_list = NIL;
List *clist;
foreach(clist, clauses)
{
ClauseInfo *clausenode = (ClauseInfo *) (lfirst(clist));
ClauseInfo *clausenode = (ClauseInfo *) (lfirst(clist));
/*
* Check to see if this clause is an 'or' clause, and, if so,
@@ -114,8 +113,8 @@ create_or_index_paths(Query *root,
* processing -- JMH, 7/7/92
*/
pathnode->path.locclauseinfo =
set_difference(copyObject((Node *)rel->clauseinfo),
lcons(clausenode,NIL));
set_difference(copyObject((Node *) rel->clauseinfo),
lcons(clausenode, NIL));
#if 0 /* fix xfunc */
/* add in cost for expensive functions! -- JMH, 7/7/92 */
@@ -156,7 +155,7 @@ create_or_index_paths(Query *root,
*/
static void
best_or_subclause_indices(Query *root,
RelOptInfo *rel,
RelOptInfo * rel,
List *subclauses,
List *indices,
List *examined_indexids,
@@ -166,9 +165,9 @@ best_or_subclause_indices(Query *root,
Cost *cost, /* return value */
List **selecs) /* return value */
{
List *slist;
foreach (slist, subclauses)
List *slist;
foreach(slist, subclauses)
{
int best_indexid;
Cost best_cost;
@@ -176,7 +175,7 @@ best_or_subclause_indices(Query *root,
best_or_subclause_index(root, rel, lfirst(slist), lfirst(indices),
&best_indexid, &best_cost, &best_selec);
examined_indexids = lappendi(examined_indexids, best_indexid);
subcost += best_cost;
selectivities = lappend(selectivities, makeFloat(best_selec));
@@ -207,25 +206,25 @@ best_or_subclause_indices(Query *root,
*/
static void
best_or_subclause_index(Query *root,
RelOptInfo *rel,
RelOptInfo * rel,
Expr *subclause,
List *indices,
int *retIndexid, /* return value */
Cost *retCost, /* return value */
Cost *retSelec) /* return value */
{
List *ilist;
bool first_run = true;
List *ilist;
bool first_run = true;
/* if we don't match anything, return zeros */
*retIndexid = 0;
*retCost = 0.0;
*retSelec = 0.0;
foreach (ilist, indices)
foreach(ilist, indices)
{
RelOptInfo *index = (RelOptInfo *) lfirst(ilist);
RelOptInfo *index = (RelOptInfo *) lfirst(ilist);
Datum value;
int flag = 0;
Cost subcost;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.12 1998/09/01 03:23:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.13 1998/09/01 04:29:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,21 +53,18 @@
* (not a join) iff it has
* a non-NULL cinfo field */
static void
xfunc_predmig(JoinPath pathnode, Stream streamroot,
static void xfunc_predmig(JoinPath pathnode, Stream streamroot,
Stream laststream, bool *progressp);
static bool xfunc_series_llel(Stream stream);
static bool xfunc_llel_chains(Stream root, Stream bottom);
static Stream xfunc_complete_stream(Stream stream);
static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme,
static bool xfunc_prdmig_pullup(Stream origstream, Stream pullme,
JoinPath joinpath);
static void xfunc_form_groups(Stream root, Stream bottom);
static void xfunc_free_stream(Stream root);
static Stream xfunc_add_clauses(Stream current);
static void xfunc_setup_group(Stream node, Stream bottom);
static Stream
xfunc_streaminsert(ClauseInfo clauseinfo, Stream current,
static Stream xfunc_streaminsert(ClauseInfo clauseinfo, Stream current,
int clausetype);
static int xfunc_num_relids(Stream node);
static StreamPtr xfunc_get_downjoin(Stream node);
@@ -77,7 +74,7 @@ static int xfunc_stream_compare(void *arg1, void *arg2);
static bool xfunc_check_stream(Stream node);
static bool xfunc_in_stream(Stream node, Stream stream);
/* ----------------- MAIN FUNCTIONS ------------------------ */
/* ----------------- MAIN FUNCTIONS ------------------------ */
/*
** xfunc_do_predmig
** wrapper for Predicate Migration. It calls xfunc_predmig until no
@@ -318,7 +315,7 @@ xfunc_complete_stream(Stream stream)
static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
{
ClauseInfo clauseinfo = get_cinfo(pullme);
ClauseInfo clauseinfo = get_cinfo(pullme);
bool progress = false;
Stream upjoin,
orignode,
@@ -492,7 +489,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
}
/* ------------------- UTILITY FUNCTIONS ------------------------- */
/* ------------------- UTILITY FUNCTIONS ------------------------- */
/*
** xfunc_free_stream --

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.16 1998/09/01 03:23:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.17 1998/09/01 04:29:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
#include "utils/elog.h"
static List *prune_joinrel(RelOptInfo *rel, List *other_rels);
static List *prune_joinrel(RelOptInfo * rel, List *other_rels);
/*
* prune-joinrels--
@@ -59,15 +59,15 @@ prune_joinrels(List *rel_list)
*
*/
static List *
prune_joinrel(RelOptInfo *rel, List *other_rels)
prune_joinrel(RelOptInfo * rel, List *other_rels)
{
List *i = NIL;
List *result = NIL;
foreach(i, other_rels)
{
RelOptInfo *other_rel = (RelOptInfo *) lfirst(i);
RelOptInfo *other_rel = (RelOptInfo *) lfirst(i);
if (same(rel->relids, other_rel->relids))
{
rel->pathlist = add_pathlist(rel,
@@ -96,7 +96,7 @@ prune_rel_paths(List *rel_list)
List *x = NIL;
List *y = NIL;
Path *path = NULL;
RelOptInfo *rel = (RelOptInfo *) NULL;
RelOptInfo *rel = (RelOptInfo *) NULL;
JoinPath *cheapest = (JoinPath *) NULL;
foreach(x, rel_list)
@@ -130,7 +130,7 @@ prune_rel_paths(List *rel_list)
*
*/
Path *
prune_rel_path(RelOptInfo *rel, Path *unorderedpath)
prune_rel_path(RelOptInfo * rel, Path *unorderedpath)
{
Path *cheapest = set_cheapest(rel, rel->pathlist);
@@ -165,7 +165,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
foreach(xrel, rel_list1)
{
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
rel_list2 = prune_joinrel(rel, rel_list2);
}
@@ -187,7 +187,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
List *
prune_oldrels(List *old_rels)
{
RelOptInfo *rel;
RelOptInfo *rel;
List *joininfo_list,
*xjoininfo,
*i,
@@ -204,7 +204,7 @@ prune_oldrels(List *old_rels)
{
foreach(xjoininfo, joininfo_list)
{
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
if (!joininfo->inactive)
{

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.21 1998/09/01 03:23:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.22 1998/09/01 04:29:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,8 +43,7 @@
#define ever ; 1 ;
/* local funcs */
static int
xfunc_card_unreferenced(Query *queryInfo,
static int xfunc_card_unreferenced(Query *queryInfo,
Expr *clause, Relid referenced);
*/
@@ -60,8 +59,8 @@ void
xfunc_trypullup(RelOptInfo rel)
{
LispValue y; /* list ptr */
ClauseInfo maxcinfo; /* The ClauseInfo to pull up, as calculated by
* xfunc_shouldpull() */
ClauseInfo maxcinfo; /* The ClauseInfo to pull up, as
* calculated by xfunc_shouldpull() */
JoinPath curpath; /* current path in list */
int progress; /* has progress been made this time
* through? */
@@ -147,12 +146,12 @@ xfunc_shouldpull(Query *queryInfo,
Path childpath,
JoinPath parentpath,
int whichchild,
ClauseInfo *maxcinfopt) /* Out: pointer to clause to
* pullup */
ClauseInfo * maxcinfopt) /* Out: pointer to clause
* to pullup */
{
LispValue clauselist,
tmplist; /* lists of clauses */
ClauseInfo maxcinfo; /* clause to pullup */
ClauseInfo maxcinfo; /* clause to pullup */
LispValue primjoinclause /* primary join clause */
= xfunc_primary_join(parentpath);
Cost tmprank,
@@ -194,7 +193,7 @@ xfunc_shouldpull(Query *queryInfo,
{
if (tmplist != LispNil &&
(tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
(tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
> maxrank)
{
maxcinfo = (ClauseInfo) lfirst(tmplist);
@@ -267,15 +266,15 @@ ClauseInfo
xfunc_pullup(Query *queryInfo,
Path childpath,
JoinPath parentpath,
ClauseInfo cinfo, /* clause to pull up */
ClauseInfo cinfo, /* clause to pull up */
int whichchild, /* whether child is INNER or OUTER of join */
int clausetype) /* whether clause to pull is join or local */
{
Path newkid;
RelOptInfo newrel;
RelOptInfo newrel;
Cost pulled_selec;
Cost cost;
ClauseInfo newinfo;
ClauseInfo newinfo;
/* remove clause from childpath */
newkid = (Path) copyObject((Node) childpath);
@@ -294,8 +293,8 @@ xfunc_pullup(Query *queryInfo,
}
/*
* * give the new child path its own RelOptInfo node that reflects the * lack
* of the pulled-up predicate
* * give the new child path its own RelOptInfo node that reflects the *
* lack of the pulled-up predicate
*/
pulled_selec = compute_clause_selec(queryInfo,
get_clause(cinfo), LispNil);
@@ -497,8 +496,8 @@ xfunc_func_expense(LispValue node, LispValue args)
/* look up tuple in cache */
tupl = SearchSysCacheTuple(PROOID,
ObjectIdGetDatum(funcid),
0, 0, 0);
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tupl))
elog(ERROR, "Cache lookup failed for procedure %d", funcid);
proc = (Form_pg_proc) GETSTRUCT(tupl);
@@ -528,7 +527,7 @@ xfunc_func_expense(LispValue node, LispValue args)
if (nargs > 0)
argOidVect = proc->proargtypes;
planlist = (List) pg_parse_and_plan(pq_src, argOidVect, nargs,
&parseTree_list, None, FALSE);
&parseTree_list, None, FALSE);
if (IsA(node, Func))
set_func_planlist((Func) node, planlist);
@@ -612,7 +611,7 @@ xfunc_width(LispValue clause)
{
/* base case: width is width of this attribute */
tupl = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(get_vartype((Var) clause)),
ObjectIdGetDatum(get_vartype((Var) clause)),
0, 0, 0);
if (!HeapTupleIsValid(tupl))
elog(ERROR, "Cache lookup failed for type %d",
@@ -682,8 +681,8 @@ xfunc_width(LispValue clause)
elog(ERROR, "Cache lookup failed for procedure %d",
get_opno((Oper) get_op(clause)));
return (xfunc_func_width
((RegProcedure) (((Form_pg_operator) (GETSTRUCT(tupl)))->oprcode),
(LispValue) get_opargs(clause)));
((RegProcedure) (((Form_pg_operator) (GETSTRUCT(tupl)))->oprcode),
(LispValue) get_opargs(clause)));
}
else if (fast_is_funcclause(clause))
{
@@ -740,7 +739,7 @@ xfunc_card_unreferenced(Query *queryInfo,
{
Assert(lnext(get_relids((RelOptInfo) lfirst(temp))) == LispNil);
allrelids = lappend(allrelids,
lfirst(get_relids((RelOptInfo) lfirst(temp))));
lfirst(get_relids((RelOptInfo) lfirst(temp))));
}
/* find all relids referenced in query but not in clause */
@@ -760,7 +759,7 @@ xfunc_card_product(Query *queryInfo, Relid relids)
{
LispValue cinfonode;
LispValue temp;
RelOptInfo currel;
RelOptInfo currel;
Cost tuples;
Count retval = 0;
@@ -777,7 +776,7 @@ xfunc_card_product(Query *queryInfo, Relid relids)
if (!xfunc_expense(queryInfo, get_clause((ClauseInfo) lfirst(cinfonode))))
tuples *=
compute_clause_selec(queryInfo,
get_clause((ClauseInfo) lfirst(cinfonode)),
get_clause((ClauseInfo) lfirst(cinfonode)),
LispNil);
}
@@ -863,7 +862,7 @@ LispValue
xfunc_primary_join(JoinPath pathnode)
{
LispValue joinclauselist = get_pathclauseinfo(pathnode);
ClauseInfo mincinfo;
ClauseInfo mincinfo;
LispValue tmplist;
LispValue minclause = LispNil;
Cost minrank,
@@ -945,7 +944,7 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode)
cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist)))
* (Cost) get_tuples(get_parent(pathnode)) * selec);
selec *= compute_clause_selec(queryInfo,
get_clause((ClauseInfo) lfirst(tmplist)),
get_clause((ClauseInfo) lfirst(tmplist)),
LispNil);
}
@@ -966,7 +965,7 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode)
cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist)))
* (Cost) get_tuples(get_parent(pathnode)) * selec);
selec *= compute_clause_selec(queryInfo,
get_clause((ClauseInfo) lfirst(tmplist)),
get_clause((ClauseInfo) lfirst(tmplist)),
LispNil);
}
}
@@ -1097,8 +1096,8 @@ xfunc_total_path_cost(JoinPath pathnode)
Cost
xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
{
RelOptInfo outerrel = get_parent((Path) get_outerjoinpath(joinnode));
RelOptInfo innerrel = get_parent((Path) get_innerjoinpath(joinnode));
RelOptInfo outerrel = get_parent((Path) get_outerjoinpath(joinnode));
RelOptInfo innerrel = get_parent((Path) get_innerjoinpath(joinnode));
Count outerwidth = get_width(outerrel);
Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
@@ -1139,7 +1138,7 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
*/
void
xfunc_fixvars(LispValue clause, /* clause being pulled up */
RelOptInfo 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 */
{
LispValue tmpclause; /* temporary variable */
@@ -1195,8 +1194,8 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
int
xfunc_cinfo_compare(void *arg1, void *arg2)
{
ClauseInfo info1 = *(ClauseInfo *) arg1;
ClauseInfo info2 = *(ClauseInfo *) arg2;
ClauseInfo info1 = *(ClauseInfo *) arg1;
ClauseInfo info2 = *(ClauseInfo *) arg2;
LispValue clause1 = (LispValue) get_clause(info1),
clause2 = (LispValue) get_clause(info2);
@@ -1310,8 +1309,8 @@ xfunc_func_width(RegProcedure funcid, LispValue args)
/* lookup function and find its return type */
Assert(RegProcedureIsValid(funcid));
tupl = SearchSysCacheTuple(PROOID,
ObjectIdGetDatum(funcid),
0, 0, 0);
ObjectIdGetDatum(funcid),
0, 0, 0);
if (!HeapTupleIsValid(tupl))
elog(ERROR, "Cache lookup failed for procedure %d", funcid);
proc = (Form_pg_proc) GETSTRUCT(tupl);
@@ -1430,9 +1429,9 @@ do { \
** Just like _copyRel, but doesn't copy the paths
*/
bool
xfunc_copyrel(RelOptInfo from, RelOptInfo *to)
xfunc_copyrel(RelOptInfo from, RelOptInfo * to)
{
RelOptInfo newnode;
RelOptInfo newnode;
Pointer (*alloc) () = palloc;