1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

Massive commit to run PGINDENT on all *.c and *.h files.

This commit is contained in:
Bruce Momjian
1997-09-07 05:04:48 +00:00
parent 8fecd4febf
commit 1ccd423235
687 changed files with 150775 additions and 136888 deletions

View File

@@ -1,24 +1,26 @@
/*-------------------------------------------------------------------------
*
* clauseinfo.h--
* prototypes for clauseinfo.c.
* prototypes for clauseinfo.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: clauseinfo.h,v 1.1 1996/08/28 07:23:10 scrappy Exp $
* $Id: clauseinfo.h,v 1.2 1997/09/07 04:58:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef CLAUSEINFO_H
#define CLAUSEINFO_H
extern bool valid_or_clause(CInfo *clauseinfo);
extern List *get_actual_clauses(List *clauseinfo_list);
extern void get_relattvals(List *clauseinfo_list, List **attnos,
List **values, List **flags);
extern void get_joinvars(Oid relid, List *clauseinfo_list,
List **attnos, List **values, List **flags);
extern List *get_opnos(List *clauseinfo_list);
extern bool valid_or_clause(CInfo * clauseinfo);
extern List *get_actual_clauses(List * clauseinfo_list);
extern void
get_relattvals(List * clauseinfo_list, List ** attnos,
List ** values, List ** flags);
extern void
get_joinvars(Oid relid, List * clauseinfo_list,
List ** attnos, List ** values, List ** flags);
extern List *get_opnos(List * clauseinfo_list);
#endif /* CLAUSEINFO_H */
#endif /* CLAUSEINFO_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* clauses.h--
* prototypes for clauses.c.
* prototypes for clauses.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: clauses.h,v 1.3 1997/08/19 21:39:01 momjian Exp $
* $Id: clauses.h,v 1.4 1997/09/07 04:58:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,37 +15,39 @@
#include <nodes/primnodes.h>
extern Expr *make_clause(int type, Node *oper, List *args);
extern bool is_opclause(Node *clause);
extern Expr *make_opclause(Oper *op, Var *leftop, Var *rightop);
extern Var *get_leftop(Expr *clause);
extern Var *get_rightop(Expr *clause);
extern Expr *make_clause(int type, Node * oper, List * args);
extern bool is_opclause(Node * clause);
extern Expr *make_opclause(Oper * op, Var * leftop, Var * rightop);
extern Var *get_leftop(Expr * clause);
extern Var *get_rightop(Expr * clause);
extern bool is_funcclause(Node *clause);
extern Expr *make_funcclause(Func *func, List *funcargs);
extern bool is_funcclause(Node * clause);
extern Expr *make_funcclause(Func * func, List * funcargs);
extern bool or_clause(Node *clause);
extern Expr *make_orclause(List *orclauses);
extern bool or_clause(Node * clause);
extern Expr *make_orclause(List * orclauses);
extern bool not_clause(Node *clause);
extern Expr *make_notclause(Expr *notclause);
extern Expr *get_notclausearg(Expr *notclause);
extern bool not_clause(Node * clause);
extern Expr *make_notclause(Expr * notclause);
extern Expr *get_notclausearg(Expr * notclause);
extern bool and_clause(Node *clause);
extern Expr *make_andclause(List *andclauses);
extern bool and_clause(Node * clause);
extern Expr *make_andclause(List * andclauses);
extern List *pull_constant_clauses(List *quals, List **constantQual);
extern void clause_relids_vars(Node *clause, List **relids, List **vars);
extern int NumRelids(Node *clause);
extern bool contains_not(Node *clause);
extern bool join_clause_p(Node *clause);
extern bool qual_clause_p(Node *clause);
extern void fix_opid(Node *clause);
extern List *fix_opids(List *clauses);
extern void get_relattval(Node *clause, int *relid,
AttrNumber *attno, Datum *constval, int *flag);
extern void get_rels_atts(Node *clause, int *relid1,
AttrNumber *attno1, int *relid2, AttrNumber *attno2);
extern void CommuteClause(Node *clause);
extern List *pull_constant_clauses(List * quals, List ** constantQual);
extern void clause_relids_vars(Node * clause, List ** relids, List ** vars);
extern int NumRelids(Node * clause);
extern bool contains_not(Node * clause);
extern bool join_clause_p(Node * clause);
extern bool qual_clause_p(Node * clause);
extern void fix_opid(Node * clause);
extern List *fix_opids(List * clauses);
extern void
get_relattval(Node * clause, int *relid,
AttrNumber * attno, Datum * constval, int *flag);
extern void
get_rels_atts(Node * clause, int *relid1,
AttrNumber * attno1, int *relid2, AttrNumber * attno2);
extern void CommuteClause(Node * clause);
#endif /* CLAUSES_H */
#endif /* CLAUSES_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* cost.h--
* prototypes for costsize.c and clausesel.c.
* prototypes for costsize.c and clausesel.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: cost.h,v 1.2 1997/08/19 21:39:18 momjian Exp $
* $Id: cost.h,v 1.3 1997/09/07 04:58:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,43 +15,48 @@
/*
* prototypes for costsize.c--
* routines to compute costs and sizes
*/
extern bool _enable_seqscan_;
extern bool _enable_indexscan_;
extern bool _enable_sort_;
extern bool _enable_hash_;
extern bool _enable_nestloop_;
extern bool _enable_mergesort_;
extern bool _enable_hashjoin_;
* routines to compute costs and sizes
*/
extern bool _enable_seqscan_;
extern bool _enable_indexscan_;
extern bool _enable_sort_;
extern bool _enable_hash_;
extern bool _enable_nestloop_;
extern bool _enable_mergesort_;
extern bool _enable_hashjoin_;
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
extern Cost cost_index(Oid indexid, int expected_indexpages, Cost selec,
int relpages, int reltuples, int indexpages,
int indextuples, bool is_injoin);
extern Cost cost_sort(List *keys, int tuples, int width, bool noread);
extern Cost cost_nestloop(Cost outercost, Cost innercost, int outertuples,
int innertuples, int outerpages, bool is_indexjoin);
extern Cost cost_mergesort(Cost outercost, Cost innercost,
List *outersortkeys, List *innersortkeys,
int outersize, int innersize, int outerwidth, int innerwidth);
extern Cost cost_hashjoin(Cost outercost, Cost innercost, List *outerkeys,
List *innerkeys, int outersize, int innersize,
int outerwidth, int innerwidth);
extern int compute_rel_size(Rel *rel);
extern int compute_rel_width(Rel *rel);
extern int compute_joinrel_size(JoinPath *joinpath);
extern int page_size(int tuples, int width);
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
extern Cost
cost_index(Oid indexid, int expected_indexpages, Cost selec,
int relpages, int reltuples, int indexpages,
int indextuples, bool is_injoin);
extern Cost cost_sort(List * keys, int tuples, int width, bool noread);
extern Cost
cost_nestloop(Cost outercost, Cost innercost, int outertuples,
int innertuples, int outerpages, bool is_indexjoin);
extern Cost
cost_mergesort(Cost outercost, Cost innercost,
List * outersortkeys, List * innersortkeys,
int outersize, int innersize, int outerwidth, int innerwidth);
extern Cost
cost_hashjoin(Cost outercost, Cost innercost, List * outerkeys,
List * innerkeys, int outersize, int innersize,
int outerwidth, int innerwidth);
extern int compute_rel_size(Rel * rel);
extern int compute_rel_width(Rel * rel);
extern int compute_joinrel_size(JoinPath * joinpath);
extern int page_size(int tuples, int width);
/*
* prototypes for fuctions in clausesel.h--
* routines to compute clause selectivities
* routines to compute clause selectivities
*/
extern void set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity);
extern Cost product_selec(List *clauseinfo_list);
extern void set_rest_relselec(Query *root, List *rel_list);
extern void set_rest_selec(Query *root,List *clauseinfo_list);
extern Cost compute_clause_selec(Query *root,
Node *clause, List *or_selectivities);
extern void set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity);
extern Cost product_selec(List * clauseinfo_list);
extern void set_rest_relselec(Query * root, List * rel_list);
extern void set_rest_selec(Query * root, List * clauseinfo_list);
extern Cost
compute_clause_selec(Query * root,
Node * clause, List * or_selectivities);
#endif /* COST_H */
#endif /* COST_H */

View File

@@ -1,25 +1,25 @@
/*-------------------------------------------------------------------------
*
* geqo.h--
* prototypes for various files in optimizer/geqo
* prototypes for various files in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo.h,v 1.3 1997/06/02 11:19:31 vadim Exp $
* $Id: geqo.h,v 1.4 1997/09/07 04:58:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_H
#define GEQO_H
#ifndef GEQO_H
#define GEQO_H
/* GEQO debug flag */
@@ -40,38 +40,39 @@
/* genetic algorithm parameters */
#define GEQO_FILE "pg_geqo" /* Name of the ga config file */
#define GEQO_FILE "pg_geqo" /* Name of the ga config file */
#define MIN_POOL 128 /* minimum number of individuals */
#define MAX_POOL 1024 /* maximum number of individuals */
#define MIN_POOL 128 /* minimum number of individuals */
#define MAX_POOL 1024 /* maximum number of individuals */
#define LOW_EFFORT 1 /* optimization effort values */
#define MEDIUM_EFFORT 40 /* are multipliers for computed */
#define HIGH_EFFORT 80 /* number of generations */
#define LOW_EFFORT 1 /* optimization effort values */
#define MEDIUM_EFFORT 40 /* are multipliers for computed */
#define HIGH_EFFORT 80 /* number of generations */
#define SELECTION_BIAS 2.0 /* selective pressure within population */
/* should be 1.5 <= SELECTION_BIAS <= 2.0 */
#define SELECTION_BIAS 2.0 /* selective pressure within population */
/* should be 1.5 <= SELECTION_BIAS <= 2.0 */
int PoolSize;
int Generations;
int PoolSize;
int Generations;
long RandomSeed; /* defaults to (long) time(NULL) in geqo_params.c */
double SelectionBias;
long RandomSeed; /* defaults to (long) time(NULL) in
* geqo_params.c */
double SelectionBias;
/* logarithmic base for rel->size decrease in case of long
queries that cause an integer overflow; used in geqo_eval.c */
#define GEQO_LOG_BASE 1.5 /* should be 1.0 < GEQO_LOG_BASE <= 2.0 */
/* ^^^ */
#define GEQO_LOG_BASE 1.5 /* should be 1.0 < GEQO_LOG_BASE <= 2.0 */
/* ^^^ */
/* geqo prototypes */
extern Rel *geqo(Query *root);
extern Rel *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);
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 Cost geqo_eval(Query * root, Gene * tour, int num_gene);
double geqo_log(double x, double b);
extern Rel *gimme_tree(Query * root, Gene * tour, int rel_count, int num_gene, Rel * outer_rel);
#endif /* GEQO_H */
#endif /* GEQO_H */

View File

@@ -1,27 +1,27 @@
/*-------------------------------------------------------------------------
*
* geqo_copy.h--
* prototypes for copy functions in optimizer/geqo
* prototypes for copy functions in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_copy.h,v 1.1 1997/02/19 12:58:32 scrappy Exp $
* $Id: geqo_copy.h,v 1.2 1997/09/07 04:58:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_COPY_H
#define GEQO_COPY_H
#ifndef GEQO_COPY_H
#define GEQO_COPY_H
extern void geqo_copy (Chromosome *chromo1, Chromosome *chromo2, int string_length);
extern void geqo_copy(Chromosome * chromo1, Chromosome * chromo2, int string_length);
#endif /* GEQO_COPY_H */
#endif /* GEQO_COPY_H */

View File

@@ -1,42 +1,44 @@
/*-------------------------------------------------------------------------
*
* geqo_gene.h--
* genome representation in optimizer/geqo
* genome representation in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_gene.h,v 1.1 1997/02/19 12:58:37 scrappy Exp $
* $Id: geqo_gene.h,v 1.2 1997/09/07 04:58:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_GENE_H
#define GEQO_GENE_H
#ifndef GEQO_GENE_H
#define GEQO_GENE_H
/* we presume that int instead of Relid
is o.k. for Gene; so don't change it! */
typedef
int Gene;
int Gene;
typedef struct Chromosome {
Gene *string;
Cost worth;
} Chromosome;
typedef struct Chromosome
{
Gene *string;
Cost worth;
} Chromosome;
typedef struct Pool {
Chromosome *data;
int size;
int string_length;
} Pool;
typedef struct Pool
{
Chromosome *data;
int size;
int string_length;
} Pool;
#endif /* GEQO_GENE_H */
#endif /* GEQO_GENE_H */

View File

@@ -1,34 +1,34 @@
/*-------------------------------------------------------------------------
*
* geqo_misc.h--
* prototypes for printout routines in optimizer/geqo
* prototypes for printout routines in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.h,v 1.1 1997/02/19 12:58:41 scrappy Exp $
* $Id: geqo_misc.h,v 1.2 1997/09/07 04:59:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_MISC_H
#define GEQO_MISC_H
#ifndef GEQO_MISC_H
#define GEQO_MISC_H
#include <stdio.h>
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_edge_table (FILE *fp, Edge *edge_table, int num_gene);
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_edge_table(FILE * fp, Edge * edge_table, int num_gene);
extern void geqo_print_rel(Query *root, Rel *rel);
extern void geqo_print_path(Query *root, Path *path, int indent);
extern void geqo_print_joinclauses(Query *root, List *clauses);
extern void geqo_print_rel(Query * root, Rel * rel);
extern void geqo_print_path(Query * root, Path * path, int indent);
extern void geqo_print_joinclauses(Query * root, List * clauses);
#endif /* GEQO_MISC_H */
#endif /* GEQO_MISC_H */

View File

@@ -1,27 +1,27 @@
/*-------------------------------------------------------------------------
*
* geqo_mutation.h--
* prototypes for mutation functions in optimizer/geqo
* prototypes for mutation functions in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_mutation.h,v 1.1 1997/02/19 12:58:49 scrappy Exp $
* $Id: geqo_mutation.h,v 1.2 1997/09/07 04:59:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_MUTATION_H
#define GEQO_MUTATION_H
#ifndef GEQO_MUTATION_H
#define GEQO_MUTATION_H
extern void geqo_mutation (Gene *tour, int num_gene);
extern void geqo_mutation(Gene * tour, int num_gene);
#endif /* GEQO_MUTATION_H */
#endif /* GEQO_MUTATION_H */

View File

@@ -1,28 +1,28 @@
/*-------------------------------------------------------------------------
*
* geqo_paths.h--
* prototypes for various subroutines in geqo_path.c
* prototypes for various subroutines in geqo_path.c
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_paths.h,v 1.1 1997/02/19 12:58:55 scrappy Exp $
* $Id: geqo_paths.h,v 1.2 1997/09/07 04:59:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_PATHS_H
#define GEQO_PATHS_H
#ifndef GEQO_PATHS_H
#define GEQO_PATHS_H
extern List *geqo_prune_rels(List *rel_list);
extern void geqo_rel_paths(Rel *rel);
extern List *geqo_prune_rels(List * rel_list);
extern void geqo_rel_paths(Rel * rel);
#endif /* GEQO_PATHS_H */
#endif /* GEQO_PATHS_H */

View File

@@ -1,37 +1,37 @@
/*-------------------------------------------------------------------------
*
* geqo_pool.h--
* pool representation in optimizer/geqo
* pool representation in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_pool.h,v 1.1 1997/02/19 12:58:59 scrappy Exp $
* $Id: geqo_pool.h,v 1.2 1997/09/07 04:59:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_POOL_H
#define GEQO_POOL_H
#ifndef GEQO_POOL_H
#define GEQO_POOL_H
extern Pool *alloc_pool(int pool_size, int string_length);
extern void free_pool(Pool *pool);
extern Pool *alloc_pool(int pool_size, int string_length);
extern void free_pool(Pool * pool);
extern void random_init_pool(Query *root, Pool *pool, int strt, int stop);
extern void random_init_pool(Query * root, Pool * pool, int strt, int stop);
extern Chromosome *alloc_chromo(int string_length);
extern void free_chromo(Chromosome *chromo);
extern void free_chromo(Chromosome * chromo);
extern void spread_chromo(Chromosome *chromo, Pool *pool);
extern void spread_chromo(Chromosome * chromo, Pool * pool);
extern void sort_pool (Pool *pool);
extern void sort_pool(Pool * pool);
#endif /* GEQO_POOL_H */
#endif /* GEQO_POOL_H */

View File

@@ -1,27 +1,27 @@
/*-------------------------------------------------------------------------
*
* geqo_random.h--
* random number generator
* random number generator
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_random.h,v 1.1 1997/02/19 12:59:02 scrappy Exp $
* $Id: geqo_random.h,v 1.2 1997/09/07 04:59:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
/* -- parts of this are adapted from D. Whitley's Genitor algorithm -- */
#ifndef GEQO_RANDOM_H
#define GEQO_RANDOM_H
#ifndef GEQO_RANDOM_H
#define GEQO_RANDOM_H
#include <math.h>
@@ -32,6 +32,6 @@
/* geqo_randint returns integer value
between lower and upper inclusive */
#define geqo_randint(upper,lower) ( (int) floor( geqo_rand()*((upper-lower)+0.999999) ) + lower )
#define geqo_randint(upper,lower) ( (int) floor( geqo_rand()*((upper-lower)+0.999999) ) + lower )
#endif /* GEQO_RANDOM_H */
#endif /* GEQO_RANDOM_H */

View File

@@ -1,20 +1,20 @@
/*-------------------------------------------------------------------------
*
* geqo_recombination.h--
* prototypes for recombination in the genetic query optimizer
* prototypes for recombination in the genetic query optimizer
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_recombination.h,v 1.1 1997/02/19 12:59:04 scrappy Exp $
* $Id: geqo_recombination.h,v 1.2 1997/09/07 04:59:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
@@ -24,54 +24,56 @@
#define GEQO_RECOMBINATION_H
extern void init_tour(Gene *tour, int num_gene);
extern void init_tour(Gene * tour, int num_gene);
/* edge recombination crossover [ERX] */
typedef struct Edge {
Gene edge_list[4]; /* list of edges */
int total_edges;
int unused_edges;
} Edge;
typedef struct Edge
{
Gene edge_list[4]; /* list of edges */
int total_edges;
int unused_edges;
} Edge;
extern Edge *alloc_edge_table(int num_gene);
extern void free_edge_table(Edge *edge_table);
extern Edge *alloc_edge_table(int num_gene);
extern void free_edge_table(Edge * edge_table);
extern float gimme_edge_table (Gene *tour1, Gene *tour2, int num_gene, Edge *edge_table);
extern float gimme_edge_table(Gene * tour1, Gene * tour2, int num_gene, Edge * edge_table);
extern int gimme_tour(Edge *edge_table, Gene *new_gene, int num_gene);
extern int gimme_tour(Edge * edge_table, Gene * new_gene, int num_gene);
/* partially matched crossover [PMX] */
#define DAD 1 /* indicator for gene from dad */
#define MOM 0 /* indicator for gene from mom */
extern void pmx(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene);
#define DAD 1 /* indicator for gene from dad */
#define MOM 0 /* indicator for gene from mom */
extern void pmx(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene);
typedef struct City {
int tour2_position;
int tour1_position;
int used;
int select_list;
} City;
typedef struct City
{
int tour2_position;
int tour1_position;
int used;
int select_list;
} City;
extern City *alloc_city_table(int num_gene);
extern void free_city_table(City *city_table);
extern City *alloc_city_table(int num_gene);
extern void free_city_table(City * city_table);
/* cycle crossover [CX] */
extern int cx(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table);
extern int cx(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table);
/* position crossover [PX] */
extern void px(Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, City *city_table);
extern void px(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table);
/* order crossover [OX1] according to Davis */
extern void ox1(Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table);
extern void ox1(Gene * mom, Gene * dad, Gene * offspring, int num_gene, City * city_table);
/* order crossover [OX2] according to Syswerda */
extern void ox2(Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table);
extern void ox2(Gene * mom, Gene * dad, Gene * offspring, int num_gene, City * city_table);
#endif /* GEQO_RECOMBINATION_H */
#endif /* GEQO_RECOMBINATION_H */

View File

@@ -1,28 +1,28 @@
/*-------------------------------------------------------------------------
*
* geqo_selection.h--
* prototypes for selection routines in optimizer/geqo
* prototypes for selection routines in optimizer/geqo
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_selection.h,v 1.1 1997/02/19 12:59:07 scrappy Exp $
* $Id: geqo_selection.h,v 1.2 1997/09/07 04:59:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_SELECTION_H
#define GEQO_SELECTION_H
#ifndef GEQO_SELECTION_H
#define GEQO_SELECTION_H
extern void geqo_selection (Chromosome *momma, Chromosome *daddy, Pool *pool, double bias);
extern void geqo_selection(Chromosome * momma, Chromosome * daddy, Pool * pool, double bias);
#endif /* GEQO_SELECTION_H */
#endif /* GEQO_SELECTION_H */

View File

@@ -1,72 +1,74 @@
/*-------------------------------------------------------------------------
*
* internal.h--
* Definitions required throughout the query optimizer.
* Definitions required throughout the query optimizer.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: internal.h,v 1.7 1997/06/03 03:15:50 vadim Exp $
* $Id: internal.h,v 1.8 1997/09/07 04:59:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef INTERNAL_H
#define INTERNAL_H
/*
* ---------- SHARED MACROS
*
* Macros common to modules for creating, accessing, and modifying
* query tree and query plan components.
* Shared with the executor.
*
/*
* ---------- SHARED MACROS
*
* Macros common to modules for creating, accessing, and modifying
* query tree and query plan components.
* Shared with the executor.
*
*/
/*
* System-dependent tuning constants
*
* System-dependent tuning constants
*
*/
#define _CPU_PAGE_WEIGHT_ 0.033 /* CPU-heap-to-page cost weighting factor */
#define _CPU_INDEX_PAGE_WEIGHT_ 0.017 /* CPU-index-to-page cost weighting factor */
#define _MAX_KEYS_ INDEX_MAX_KEYS /* maximum number of keys in an index */
#define _TID_SIZE_ 6 /* sizeof(itemid) (from ../h/itemid.h) */
#define _CPU_PAGE_WEIGHT_ 0.033/* CPU-heap-to-page cost weighting factor */
#define _CPU_INDEX_PAGE_WEIGHT_ 0.017 /* CPU-index-to-page cost
* weighting factor */
#define _MAX_KEYS_ INDEX_MAX_KEYS /* maximum number of keys in an
* index */
#define _TID_SIZE_ 6 /* sizeof(itemid) (from ../h/itemid.h) */
/*
* Size estimates
*
/*
* Size estimates
*
*/
/* The cost of sequentially scanning a materialized temporary relation
/* The cost of sequentially scanning a materialized temporary relation
*/
#define _TEMP_SCAN_COST_ 10
#define _TEMP_SCAN_COST_ 10
/* The number of pages and tuples in a materialized relation
/* The number of pages and tuples in a materialized relation
*/
#define _TEMP_RELATION_PAGES_ 1
#define _TEMP_RELATION_TUPLES_ 10
#define _TEMP_RELATION_PAGES_ 1
#define _TEMP_RELATION_TUPLES_ 10
/* The length of a variable-length field in bytes
/* The length of a variable-length field in bytes
*/
#define _DEFAULT_ATTRIBUTE_WIDTH_ (2 * _TID_SIZE_)
/*
* Flags and identifiers
*
/*
* Flags and identifiers
*
*/
/* Identifier for (sort) temp relations */
/* Identifier for (sort) temp relations */
/* used to be -1 */
#define _TEMP_RELATION_ID_ InvalidOid
#define _TEMP_RELATION_ID_ InvalidOid
/* Identifier for invalid relation OIDs and attribute numbers for use by
* selectivity functions
/* Identifier for invalid relation OIDs and attribute numbers for use by
* selectivity functions
*/
#define _SELEC_VALUE_UNKNOWN_ -1
#define _SELEC_VALUE_UNKNOWN_ -1
/* Flag indicating that a clause constant is really a parameter (or other
* non-constant?), a non-parameter, or a constant on the right side
* of the clause.
/* Flag indicating that a clause constant is really a parameter (or other
* non-constant?), a non-parameter, or a constant on the right side
* of the clause.
*/
#define _SELEC_NOT_CONSTANT_ 0
#define _SELEC_IS_CONSTANT_ 1
@@ -78,11 +80,12 @@
#define FLOAT_EQUAL(X,Y) ((X) - (Y) < TOLERANCE)
#define FLOAT_IS_ZERO(X) (FLOAT_EQUAL(X,0.0))
extern int BushyPlanFlag;
/* #define deactivate_joininfo(joininfo) joininfo->inactive=true*/
extern int BushyPlanFlag;
/* #define deactivate_joininfo(joininfo) joininfo->inactive=true*/
/*#define joininfo_inactive(joininfo) joininfo->inactive */
/* GEQO switch according to number of relations in a query */
#define GEQO_RELS 6
#endif /* INTERNAL_H */
#endif /* INTERNAL_H */

View File

@@ -1,20 +1,20 @@
/*-------------------------------------------------------------------------
*
* joininfo.h--
* prototypes for joininfo.c.
* prototypes for joininfo.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: joininfo.h,v 1.1 1996/08/28 07:23:14 scrappy Exp $
* $Id: joininfo.h,v 1.2 1997/09/07 04:59:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef JOININFO_H
#define JOININFO_H
extern JInfo *joininfo_member(List *join_relids, List *joininfo_list);
extern JInfo *find_joininfo_node(Rel *this_rel, List *join_relids);
extern Var *other_join_clause_var(Var *var, Expr *clause);
extern JInfo *joininfo_member(List * join_relids, List * joininfo_list);
extern JInfo *find_joininfo_node(Rel * this_rel, List * join_relids);
extern Var *other_join_clause_var(Var * var, Expr * clause);
#endif /* JOININFO_H */
#endif /* JOININFO_H */

View File

@@ -1,21 +1,21 @@
/*-------------------------------------------------------------------------
*
* keys.h--
* prototypes for keys.c.
* prototypes for keys.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: keys.h,v 1.2 1997/08/19 21:39:25 momjian Exp $
* $Id: keys.h,v 1.3 1997/09/07 04:59:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef KEYS_H
#define KEYS_H
extern bool match_indexkey_operand(int indexkey, Var *operand, Rel *rel);
extern Var *extract_subkey(JoinKey *jk, int which_subkey);
extern bool samekeys(List *keys1, List *keys2);
extern List *collect_index_pathkeys(int *index_keys, List *tlist);
extern bool match_indexkey_operand(int indexkey, Var * operand, Rel * rel);
extern Var *extract_subkey(JoinKey * jk, int which_subkey);
extern bool samekeys(List * keys1, List * keys2);
extern List *collect_index_pathkeys(int *index_keys, List * tlist);
#endif /* KEYS_H */
#endif /* KEYS_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* ordering.h--
* prototypes for ordering.c.
* prototypes for ordering.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: ordering.h,v 1.3 1997/08/19 21:39:29 momjian Exp $
* $Id: ordering.h,v 1.4 1997/09/07 04:59:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,10 +15,14 @@
#include <nodes/relation.h>
extern bool equal_path_path_ordering(PathOrder *path_ordering1,
PathOrder *path_ordering2);
extern bool equal_path_merge_ordering(Oid *path_ordering,
MergeOrder *merge_ordering);
extern bool equal_merge_merge_ordering(MergeOrder *merge_ordering1,
MergeOrder *merge_ordering2);
#endif /* ORDERING_H */
extern bool
equal_path_path_ordering(PathOrder * path_ordering1,
PathOrder * path_ordering2);
extern bool
equal_path_merge_ordering(Oid * path_ordering,
MergeOrder * merge_ordering);
extern bool
equal_merge_merge_ordering(MergeOrder * merge_ordering1,
MergeOrder * merge_ordering2);
#endif /* ORDERING_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* pathnode.h--
* prototypes for pathnode.c, indexnode.c, relnode.c.
* prototypes for pathnode.c, indexnode.c, relnode.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pathnode.h,v 1.1 1996/08/28 07:23:18 scrappy Exp $
* $Id: pathnode.h,v 1.2 1997/09/07 04:59:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,35 +16,40 @@
/*
* prototypes for pathnode.c
*/
extern bool path_is_cheaper(Path *path1, Path *path2);
extern Path *set_cheapest(Rel *parent_rel, List *pathlist);
extern List *add_pathlist(Rel *parent_rel, List *unique_paths,
List *new_paths);
extern Path *create_seqscan_path(Rel *rel);
extern IndexPath *create_index_path(Query *root, Rel *rel, Rel *index,
List *restriction_clauses, bool is_join_scan);
extern JoinPath *create_nestloop_path(Rel *joinrel, Rel *outer_rel,
Path *outer_path, Path *inner_path, List *keys);
extern MergePath *create_mergesort_path(Rel *joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path *outer_path,
Path *inner_path, List *keys, MergeOrder *order,
List *mergeclauses, List *outersortkeys, List *innersortkeys);
extern bool path_is_cheaper(Path * path1, Path * path2);
extern Path *set_cheapest(Rel * parent_rel, List * pathlist);
extern List *
add_pathlist(Rel * parent_rel, List * unique_paths,
List * new_paths);
extern Path *create_seqscan_path(Rel * rel);
extern IndexPath *
create_index_path(Query * root, Rel * rel, Rel * index,
List * restriction_clauses, bool is_join_scan);
extern JoinPath *
create_nestloop_path(Rel * joinrel, Rel * outer_rel,
Path * outer_path, Path * inner_path, List * keys);
extern MergePath *
create_mergesort_path(Rel * joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path * outer_path,
Path * inner_path, List * keys, MergeOrder * order,
List * mergeclauses, List * outersortkeys, List * innersortkeys);
extern HashPath *create_hashjoin_path(Rel *joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path *outer_path,
Path *inner_path, List *keys, Oid operator, List *hashclauses,
List *outerkeys, List *innerkeys);
extern HashPath *
create_hashjoin_path(Rel * joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path * outer_path,
Path * inner_path, List * keys, Oid operator, List * hashclauses,
List * outerkeys, List * innerkeys);
/*
* prototypes for rel.c
*/
extern Rel *rel_member(List *relid, List *rels);
extern Rel *get_base_rel(Query* root, int relid);
extern Rel *get_join_rel(Query* root, List *relid);
extern Rel *rel_member(List * relid, List * rels);
extern Rel *get_base_rel(Query * root, int relid);
extern Rel *get_join_rel(Query * root, List * relid);
/*
* prototypes for indexnode.h
*/
extern List *find_relation_indices(Query *root,Rel *rel);
extern List *find_relation_indices(Query * root, Rel * rel);
#endif /* PATHNODE_H */
#endif /* PATHNODE_H */

View File

@@ -1,89 +1,97 @@
/*-------------------------------------------------------------------------
*
* paths.h--
* prototypes for various files in optimizer/paths (were separate
* header files
* prototypes for various files in optimizer/paths (were separate
* header files
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.1 1996/08/28 07:23:19 scrappy Exp $
* $Id: paths.h,v 1.2 1997/09/07 04:59:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PATHS_H
#define PATHS_H
#ifndef PATHS_H
#define PATHS_H
/*
* allpaths.h
*/
extern List *find_paths(Query *root, List *rels);
extern List *find_paths(Query * root, List * rels);
/*
* indxpath.h
* routines to generate index paths
* routines to generate index paths
*/
extern List *find_index_paths(Query *root, Rel *rel, List *indices,
List *clauseinfo_list,
List *joininfo_list);
extern List *
find_index_paths(Query * root, Rel * rel, List * indices,
List * clauseinfo_list,
List * joininfo_list);
/*
* joinpath.h
* routines to create join paths
* routines to create join paths
*/
extern void find_all_join_paths(Query *root, List *joinrels);
extern void find_all_join_paths(Query * root, List * joinrels);
/*
* orindxpath.h
*/
extern List *create_or_index_paths(Query *root, Rel *rel, List *clauses);
extern List *create_or_index_paths(Query * root, Rel * rel, List * clauses);
/*
* hashutils.h
* routines to deal with hash keys and clauses
* routines to deal with hash keys and clauses
*/
extern List *group_clauses_by_hashop(List *clauseinfo_list,
int inner_relid);
extern List *
group_clauses_by_hashop(List * clauseinfo_list,
int inner_relid);
/*
* joinutils.h
* generic join method key/clause routines
* generic join method key/clause routines
*/
extern List *match_pathkeys_joinkeys(List *pathkeys,
List *joinkeys, List *joinclauses, int which_subkey,
List **matchedJoinClausesPtr);
extern List *extract_path_keys(List *joinkeys, List *tlist,
int which_subkey);
extern Path *match_paths_joinkeys(List *joinkeys, PathOrder *ordering,
List *paths, int which_subkey);
extern List *new_join_pathkeys(List *outer_pathkeys,
List *join_rel_tlist, List *joinclauses);
extern List *
match_pathkeys_joinkeys(List * pathkeys,
List * joinkeys, List * joinclauses, int which_subkey,
List ** matchedJoinClausesPtr);
extern List *
extract_path_keys(List * joinkeys, List * tlist,
int which_subkey);
extern Path *
match_paths_joinkeys(List * joinkeys, PathOrder * ordering,
List * paths, int which_subkey);
extern List *
new_join_pathkeys(List * outer_pathkeys,
List * join_rel_tlist, List * joinclauses);
/*
* mergeutils.h
* routines to deal with merge keys and clauses
* routines to deal with merge keys and clauses
*/
extern List *group_clauses_by_order(List *clauseinfo_list,
int inner_relid);
extern MInfo *match_order_mergeinfo(PathOrder *ordering,
List *mergeinfo_list);
extern List *
group_clauses_by_order(List * clauseinfo_list,
int inner_relid);
extern MInfo *
match_order_mergeinfo(PathOrder * ordering,
List * mergeinfo_list);
/*
* joinrels.h
* routines to determine which relations to join
* routines to determine which relations to join
*/
extern List *find_join_rels(Query *root, List *outer_rels);
extern void add_new_joininfos(Query *root, List *joinrels, List *outerrels);
extern List *final_join_rels(List *join_rel_list);
extern List *find_join_rels(Query * root, List * outer_rels);
extern void add_new_joininfos(Query * root, List * joinrels, List * outerrels);
extern List *final_join_rels(List * join_rel_list);
/*
* prototypes for path/prune.c
*/
extern List *prune_joinrels(List *rel_list);
extern void prune_rel_paths(List *rel_list);
extern Path *prune_rel_path(Rel *rel, Path *unorderedpath);
extern List *merge_joinrels(List *rel_list1, List *rel_list2);
extern List *prune_oldrels(List *old_rels);
extern List *prune_joinrels(List * rel_list);
extern void prune_rel_paths(List * rel_list);
extern Path *prune_rel_path(Rel * rel, Path * unorderedpath);
extern List *merge_joinrels(List * rel_list1, List * rel_list2);
extern List *prune_oldrels(List * old_rels);
#endif /* PATHS_H */
#endif /* PATHS_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* plancat.h--
* prototypes for plancat.c.
* prototypes for plancat.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: plancat.h,v 1.3 1996/11/06 09:24:57 scrappy Exp $
* $Id: plancat.h,v 1.4 1997/09/07 04:59:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,47 +19,50 @@
* transient data structure to hold return value of index_info. Note that
* indexkeys, orderOprs and classlist is "null-terminated".
*/
typedef struct IdxInfoRetval {
Oid relid; /* OID of the index relation (not the OID
* of the relation being indexed)
*/
Oid relam; /* OID of the pg_am of this index */
int pages; /* number of pages in the index relation */
int tuples; /* number of tuples in the index relation */
int *indexkeys; /* keys over which we're indexing */
Oid *orderOprs; /* operators used for ordering purposes */
Oid *classlist; /* classes of AM operators */
Oid indproc;
Node *indpred;
} IdxInfoRetval;
typedef struct IdxInfoRetval
{
Oid relid; /* OID of the index relation (not the OID
* of the relation being indexed) */
Oid relam; /* OID of the pg_am of this index */
int pages; /* number of pages in the index relation */
int tuples; /* number of tuples in the index relation */
int *indexkeys; /* keys over which we're indexing */
Oid *orderOprs; /* operators used for ordering purposes */
Oid *classlist; /* classes of AM operators */
Oid indproc;
Node *indpred;
} IdxInfoRetval;
extern void relation_info(Query *root,
Oid relid,
bool *hashindex, int *pages,
int *tuples);
extern bool index_info(Query *root,
bool first, int relid, IdxInfoRetval *info);
extern Cost
restriction_selectivity(Oid functionObjectId,
Oid operatorObjectId,
Oid relationObjectId,
AttrNumber attributeNumber,
char *constValue,
int32 constFlag);
extern void
index_selectivity(Oid indid, Oid *classes, List *opnos,
Oid relid, List *attnos, List *values, List *flags,
int32 nkeys, float *idxPages, float *idxSelec);
relation_info(Query * root,
Oid relid,
bool * hashindex, int *pages,
int *tuples);
extern Cost join_selectivity(Oid functionObjectId, Oid operatorObjectId,
Oid relationObjectId1, AttrNumber attributeNumber1,
Oid relationObjectId2, AttrNumber attributeNumber2);
extern bool
index_info(Query * root,
bool first, int relid, IdxInfoRetval * info);
extern List *find_inheritance_children(Oid inhparent);
extern List *VersionGetParents(Oid verrelid);
extern Cost
restriction_selectivity(Oid functionObjectId,
Oid operatorObjectId,
Oid relationObjectId,
AttrNumber attributeNumber,
char *constValue,
int32 constFlag);
#endif /* PLANCAT_H */
extern void
index_selectivity(Oid indid, Oid * classes, List * opnos,
Oid relid, List * attnos, List * values, List * flags,
int32 nkeys, float *idxPages, float *idxSelec);
extern Cost
join_selectivity(Oid functionObjectId, Oid operatorObjectId,
Oid relationObjectId1, AttrNumber attributeNumber1,
Oid relationObjectId2, AttrNumber attributeNumber2);
extern List *find_inheritance_children(Oid inhparent);
extern List *VersionGetParents(Oid verrelid);
#endif /* PLANCAT_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* planmain.h--
* prototypes for various files in optimizer/plan
* prototypes for various files in optimizer/plan
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: planmain.h,v 1.1 1996/08/28 07:23:23 scrappy Exp $
* $Id: planmain.h,v 1.2 1997/09/07 04:59:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,44 +17,50 @@
/*
* prototypes for plan/planmain.c
*/
extern Plan *query_planner(Query *root,
int command_type, List *tlist, List *qual);
extern Plan *
query_planner(Query * root,
int command_type, List * tlist, List * qual);
/*
* prototypes for plan/createplan.c
*/
extern Plan *create_plan(Path *best_path);
extern SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid,
Plan *lefttree);
extern Sort *make_sort(List *tlist, Oid tempid, Plan *lefttree,
int keycount);
extern Agg *make_agg(List *tlist, int nagg, Aggreg **aggs);
extern Group *make_group(List *tlist, bool tuplePerGroup, int ngrp,
AttrNumber *grpColIdx, Sort *lefttree);
extern Unique *make_unique(List *tlist, Plan *lefttree, char *uniqueAttr);
extern List *generate_fjoin(List *tlist);
extern Plan *create_plan(Path * best_path);
extern SeqScan *
make_seqscan(List * qptlist, List * qpqual, Index scanrelid,
Plan * lefttree);
extern Sort *
make_sort(List * tlist, Oid tempid, Plan * lefttree,
int keycount);
extern Agg *make_agg(List * tlist, int nagg, Aggreg ** aggs);
extern Group *
make_group(List * tlist, bool tuplePerGroup, int ngrp,
AttrNumber * grpColIdx, Sort * lefttree);
extern Unique *make_unique(List * tlist, Plan * lefttree, char *uniqueAttr);
extern List *generate_fjoin(List * tlist);
/*
* prototypes for plan/initsplan.c
*/
extern void initialize_base_rels_list(Query *root, List *tlist);
extern void initialize_base_rels_jinfo(Query *root, List *clauses);
extern void initialize_join_clause_info(List *rel_list);
extern void add_missing_vars_to_base_rels(Query *root, List *tlist);
extern void initialize_base_rels_list(Query * root, List * tlist);
extern void initialize_base_rels_jinfo(Query * root, List * clauses);
extern void initialize_join_clause_info(List * rel_list);
extern void add_missing_vars_to_base_rels(Query * root, List * tlist);
/*
* prototypes for plan/setrefs.c
*/
extern void set_tlist_references(Plan *plan);
extern List *join_references(List *clauses, List *outer_tlist,
List *inner_tlist);
extern List *index_outerjoin_references(List *inner_indxqual,
List *outer_tlist, Index inner_relid);
extern void set_result_tlist_references(Result *resultNode);
extern void set_agg_tlist_references(Agg *aggNode);
extern void set_agg_agglist_references(Agg *aggNode);
extern void set_tlist_references(Plan * plan);
extern List *
join_references(List * clauses, List * outer_tlist,
List * inner_tlist);
extern List *
index_outerjoin_references(List * inner_indxqual,
List * outer_tlist, Index inner_relid);
extern void set_result_tlist_references(Result * resultNode);
extern void set_agg_tlist_references(Agg * aggNode);
extern void set_agg_agglist_references(Agg * aggNode);
#endif /* PLANMAIN_H */
#endif /* PLANMAIN_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* planner.h--
* prototypes for planner.c.
* prototypes for planner.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: planner.h,v 1.2 1996/11/06 10:30:20 scrappy Exp $
* $Id: planner.h,v 1.3 1997/09/07 04:59:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
/*
*/
extern Plan *planner(Query *parse);
extern void pg_checkretval(Oid rettype, QueryTreeList *querytree_list);
extern Plan *planner(Query * parse);
extern void pg_checkretval(Oid rettype, QueryTreeList * querytree_list);
#endif /* PLANNER_H */
#endif /* PLANNER_H */

View File

@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
* prep.h--
* prototypes for files in prep.c
* prototypes for files in prep.c
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: prep.h,v 1.2 1996/11/06 09:17:31 scrappy Exp $
* $Id: prep.h,v 1.3 1997/09/07 04:59:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PREP_H
#define PREP_H
#define PREP_H
#include <nodes/plannodes.h>
#include <nodes/parsenodes.h>
@@ -19,33 +19,38 @@
/*
* prototypes for archive.h
*/
extern void plan_archive(List *rt);
extern List *find_archive_rels(Oid relid);
extern void plan_archive(List * rt);
extern List *find_archive_rels(Oid relid);
/*
* prototypes for prepqual.h
*/
extern List *preprocess_qualification(Expr *qual, List *tlist,
List **existentialQualPtr);
extern List *cnfify(Expr *qual, bool removeAndFlag);
extern List *
preprocess_qualification(Expr * qual, List * tlist,
List ** existentialQualPtr);
extern List *cnfify(Expr * qual, bool removeAndFlag);
/*
* prototypes for preptlist.h
*/
extern List *preprocess_targetlist(List *tlist, int command_type,
Index result_relation, List *range_table);
extern List *
preprocess_targetlist(List * tlist, int command_type,
Index result_relation, List * range_table);
/*
* prototypes for prepunion.h
*/
typedef enum UnionFlag {
INHERITS_FLAG, ARCHIVE_FLAG, VERSION_FLAG
} UnionFlag;
typedef enum UnionFlag
{
INHERITS_FLAG, ARCHIVE_FLAG, VERSION_FLAG
} UnionFlag;
extern List *find_all_inheritors(List *unexamined_relids,
List *examined_relids);
extern int first_matching_rt_entry(List *rangetable, UnionFlag flag);
extern Append *plan_union_queries(Index rt_index, Query *parse,
UnionFlag flag);
extern List *
find_all_inheritors(List * unexamined_relids,
List * examined_relids);
extern int first_matching_rt_entry(List * rangetable, UnionFlag flag);
extern Append *
plan_union_queries(Index rt_index, Query * parse,
UnionFlag flag);
#endif /* PREP_H */
#endif /* PREP_H */

View File

@@ -1,34 +1,36 @@
/*-------------------------------------------------------------------------
*
* tlist.h--
* prototypes for tlist.c.
* prototypes for tlist.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tlist.h,v 1.2 1997/08/19 21:39:31 momjian Exp $
* $Id: tlist.h,v 1.3 1997/09/07 04:59:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TLIST_H
#define TLIST_H
extern int exec_tlist_length(List *targelist);
extern TargetEntry *tlistentry_member(Var *var, List *targetlist);
extern Expr *matching_tlvar(Var *var, List *targetlist);
extern void add_tl_element(Rel *rel, Var *var);
extern TargetEntry *create_tl_element(Var *var, int resdomno);
extern List *get_actual_tlist(List *tlist);
extern Resdom *tlist_member(Var *var, List *tlist);
extern Resdom *tlist_resdom(List *tlist, Resdom *resnode);
extern int exec_tlist_length(List * targelist);
extern TargetEntry *tlistentry_member(Var * var, List * targetlist);
extern Expr *matching_tlvar(Var * var, List * targetlist);
extern void add_tl_element(Rel * rel, Var * var);
extern TargetEntry *create_tl_element(Var * var, int resdomno);
extern List *get_actual_tlist(List * tlist);
extern Resdom *tlist_member(Var * var, List * tlist);
extern Resdom *tlist_resdom(List * tlist, Resdom * resnode);
extern TargetEntry *MakeTLE(Resdom *resdom, Node *expr);
extern Var *get_expr(TargetEntry *tle);
extern TargetEntry *MakeTLE(Resdom * resdom, Node * expr);
extern Var *get_expr(TargetEntry * tle);
extern TargetEntry *match_varid(Var *test_var, List *tlist);
extern List *new_unsorted_tlist(List *targetlist);
extern List *copy_vars(List *target, List *source);
extern List *flatten_tlist(List *tlist);
extern List *flatten_tlist_vars(List *full_tlist,
List *flat_tlist);
#endif /* TLIST_H */
extern TargetEntry *match_varid(Var * test_var, List * tlist);
extern List *new_unsorted_tlist(List * targetlist);
extern List *copy_vars(List * target, List * source);
extern List *flatten_tlist(List * tlist);
extern List *
flatten_tlist_vars(List * full_tlist,
List * flat_tlist);
#endif /* TLIST_H */

View File

@@ -1,21 +1,21 @@
/*-------------------------------------------------------------------------
*
* var.h--
* prototypes for var.c.
* prototypes for var.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: var.h,v 1.1 1996/08/28 07:23:29 scrappy Exp $
* $Id: var.h,v 1.2 1997/09/07 04:59:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef VAR_H
#define VAR_H
extern List *pull_varnos(Node *me);
extern bool contain_var_clause(Node *clause);
extern List *pull_var_clause(Node *clause);
extern bool var_equal(Var *var1, Var *var2);
extern List *pull_varnos(Node * me);
extern bool contain_var_clause(Node * clause);
extern List *pull_var_clause(Node * clause);
extern bool var_equal(Var * var1, Var * var2);
#endif /* VAR_H */
#endif /* VAR_H */

View File

@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* xfunc.h--
* prototypes for xfunc.c and predmig.c.
* prototypes for xfunc.c and predmig.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: xfunc.h,v 1.2 1996/11/06 07:44:13 scrappy Exp $
* $Id: xfunc.h,v 1.3 1997/09/07 04:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,19 +17,21 @@
#include <nodes/relation.h>
/* command line arg flags */
#define XFUNC_OFF -1 /* do no optimization of expensive preds */
#define XFUNC_NOR 2 /* do no optimization of OR clauses */
#define XFUNC_NOPULL 4 /* never pull restrictions above joins */
#define XFUNC_NOPM 8 /* don't do predicate migration */
#define XFUNC_WAIT 16 /* don't do pullup until predicate migration */
#define XFUNC_PULLALL 32 /* pull all expensive restrictions up, always */
#define XFUNC_OFF -1 /* do no optimization of expensive preds */
#define XFUNC_NOR 2 /* do no optimization of OR clauses */
#define XFUNC_NOPULL 4 /* never pull restrictions above joins */
#define XFUNC_NOPM 8 /* don't do predicate migration */
#define XFUNC_WAIT 16 /* don't do pullup until predicate
* migration */
#define XFUNC_PULLALL 32 /* pull all expensive restrictions up,
* always */
/* constants for local and join predicates */
#define XFUNC_LOCPRD 1
#define XFUNC_JOINPRD 2
#define XFUNC_UNKNOWN 0
extern int XfuncMode; /* defined in tcop/postgres.c */
extern int XfuncMode; /* defined in tcop/postgres.c */
/* defaults for function attributes used for expensive function calculations */
#define BYTE_PCT 100
@@ -47,39 +49,42 @@ extern int XfuncMode; /* defined in tcop/postgres.c */
#define is_join(pathnode) (length(get_relids(get_parent(pathnode))) > 1 ? 1 : 0)
/* function prototypes from planner/path/xfunc.c */
extern void xfunc_trypullup(Rel *rel);
extern int xfunc_shouldpull(Path *childpath, JoinPath *parentpath,
int whichchild, CInfo *maxcinfopt);
extern CInfo *xfunc_pullup(Path *childpath, JoinPath *parentpath, CInfo *cinfo,
int whichchild, int clausetype);
extern Cost xfunc_rank(Expr *clause);
extern Cost xfunc_expense(Query* queryInfo, Expr *clause);
extern Cost xfunc_join_expense(JoinPath *path, int whichchild);
extern Cost xfunc_local_expense(Expr *clause);
extern Cost xfunc_func_expense(Expr *node, List *args);
extern int xfunc_width(Expr *clause);
extern void xfunc_trypullup(Rel * rel);
extern int
xfunc_shouldpull(Path * childpath, JoinPath * parentpath,
int whichchild, CInfo * maxcinfopt);
extern CInfo *
xfunc_pullup(Path * childpath, JoinPath * parentpath, CInfo * cinfo,
int whichchild, int clausetype);
extern Cost xfunc_rank(Expr * clause);
extern Cost xfunc_expense(Query * queryInfo, Expr * clause);
extern Cost xfunc_join_expense(JoinPath * path, int whichchild);
extern Cost xfunc_local_expense(Expr * clause);
extern Cost xfunc_func_expense(Expr * node, List * args);
extern int xfunc_width(Expr * clause);
/* static, moved to xfunc.c */
/* extern int xfunc_card_unreferenced(Expr *clause, Relid referenced); */
extern int xfunc_card_product(Relid relids);
extern List *xfunc_find_references(List *clause);
extern List *xfunc_primary_join(JoinPath *pathnode);
extern Cost xfunc_get_path_cost(Path *pathnode);
extern Cost xfunc_total_path_cost(JoinPath *pathnode);
extern Cost xfunc_expense_per_tuple(JoinPath *joinnode, int whichchild);
extern void xfunc_fixvars(Expr *clause, Rel *rel, int varno);
extern int xfunc_cinfo_compare(void *arg1, void *arg2);
extern int xfunc_clause_compare(void *arg1, void *arg2);
extern void xfunc_disjunct_sort(List *clause_list);
extern int xfunc_disjunct_compare(void *arg1, void *arg2);
extern int xfunc_func_width(RegProcedure funcid, List *args);
extern int xfunc_tuple_width(Relation rd);
extern int xfunc_num_join_clauses(JoinPath *path);
extern List *xfunc_LispRemove(List *foo, List *bar);
extern bool xfunc_copyrel(Rel *from, Rel **to);
extern int xfunc_card_product(Relid relids);
extern List *xfunc_find_references(List * clause);
extern List *xfunc_primary_join(JoinPath * pathnode);
extern Cost xfunc_get_path_cost(Path * pathnode);
extern Cost xfunc_total_path_cost(JoinPath * pathnode);
extern Cost xfunc_expense_per_tuple(JoinPath * joinnode, int whichchild);
extern void xfunc_fixvars(Expr * clause, Rel * rel, int varno);
extern int xfunc_cinfo_compare(void *arg1, void *arg2);
extern int xfunc_clause_compare(void *arg1, void *arg2);
extern void xfunc_disjunct_sort(List * clause_list);
extern int xfunc_disjunct_compare(void *arg1, void *arg2);
extern int xfunc_func_width(RegProcedure funcid, List * args);
extern int xfunc_tuple_width(Relation rd);
extern int xfunc_num_join_clauses(JoinPath * path);
extern List *xfunc_LispRemove(List * foo, List * bar);
extern bool xfunc_copyrel(Rel * from, Rel ** to);
/*
* function prototypes for path/predmig.c
*/
extern bool xfunc_do_predmig(Path root);
extern bool xfunc_do_predmig(Path root);
#endif /* XFUNC_H */
#endif /* XFUNC_H */