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

Modify optimizer data structures so that IndexOptInfo lists built for

create_index_paths are not immediately discarded, but are available for
subsequent planner work.  This allows avoiding redundant syscache lookups
in several places.  Change interface to operator selectivity estimation
procedures to allow faster and more flexible estimation.
Initdb forced due to change of pg_proc entries for selectivity functions!
This commit is contained in:
Tom Lane
2001-05-20 20:28:20 +00:00
parent 5d53389cfe
commit be03eb25f3
32 changed files with 1147 additions and 1218 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: clauses.h,v 1.43 2001/03/22 04:00:53 momjian Exp $
* $Id: clauses.h,v 1.44 2001/05/20 20:28:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,14 +16,6 @@
#include "nodes/relation.h"
/*
* Flag bits returned by get_relattval().
* These are used in selectivity-estimation routines, too.
*/
#define SEL_CONSTANT 1 /* operator's non-var arg is a constant */
#define SEL_RIGHT 2 /* operator's non-var arg is on the right */
extern Expr *make_clause(int type, Node *oper, List *args);
extern bool is_opclause(Node *clause);
@@ -61,11 +53,6 @@ extern List *pull_constant_clauses(List *quals, List **constantQual);
extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
extern int NumRelids(Node *clause);
extern void get_relattval(Node *clause, int targetrelid,
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(Expr *clause);
extern Node *eval_const_expressions(Node *node);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pathnode.h,v 1.36 2001/05/07 00:43:26 tgl Exp $
* $Id: pathnode.h,v 1.37 2001/05/20 20:28:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,9 +64,10 @@ extern HashPath *create_hashjoin_path(RelOptInfo *joinrel,
/*
* prototypes for relnode.c
*/
extern RelOptInfo *get_base_rel(Query *root, int relid);
extern RelOptInfo *make_base_rel(Query *root, int relid);
extern RelOptInfo *get_join_rel(Query *root,
extern RelOptInfo *build_base_rel(Query *root, int relid);
extern RelOptInfo *build_other_rel(Query *root, int relid);
extern RelOptInfo *find_base_rel(Query *root, int relid);
extern RelOptInfo *build_join_rel(Query *root,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel,
JoinType jointype,

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.52 2001/03/22 04:00:54 momjian Exp $
* $Id: paths.h,v 1.53 2001/05/20 20:28:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@ extern RelOptInfo *make_fromexpr_rel(Query *root, FromExpr *from);
* indxpath.c
* routines to generate index paths
*/
extern void create_index_paths(Query *root, RelOptInfo *rel, List *indices);
extern void create_index_paths(Query *root, RelOptInfo *rel);
extern Oid indexable_operator(Expr *clause, Oid opclass, Oid relam,
bool indexkey_on_left);
extern List *extract_or_indexqual_conditions(RelOptInfo *rel,

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: plancat.h,v 1.22 2001/03/22 04:00:55 momjian Exp $
* $Id: plancat.h,v 1.23 2001/05/20 20:28:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,7 @@
#include "nodes/relation.h"
extern void relation_info(Oid relationObjectId,
extern void get_relation_info(Oid relationObjectId,
bool *hasindex, long *pages, double *tuples);
extern List *find_secondary_indexes(Oid relationObjectId);
@@ -26,15 +26,15 @@ extern List *find_inheritance_children(Oid inhparent);
extern bool has_subclass(Oid relationId);
extern Selectivity restriction_selectivity(Oid functionObjectId,
Oid operatorObjectId,
Oid relationObjectId,
AttrNumber attributeNumber,
Datum constValue,
int constFlag);
extern bool has_unique_index(RelOptInfo *rel, AttrNumber attno);
extern Selectivity join_selectivity(Oid functionObjectId, Oid operatorObjectId,
Oid relationObjectId1, AttrNumber attributeNumber1,
Oid relationObjectId2, AttrNumber attributeNumber2);
extern Selectivity restriction_selectivity(Query *root,
Oid operator,
List *args,
int varRelid);
extern Selectivity join_selectivity(Query *root,
Oid operator,
List *args);
#endif /* PLANCAT_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: prep.h,v 1.27 2001/03/22 04:00:55 momjian Exp $
* $Id: prep.h,v 1.28 2001/05/20 20:28:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,9 @@ extern List *preprocess_targetlist(List *tlist, int command_type,
extern Plan *plan_set_operations(Query *parse);
extern List *find_all_inheritors(Oid parentrel);
extern List *expand_inherted_rtentry(Query *parse, Index rti);
extern List *expand_inherted_rtentry(Query *parse, Index rti,
bool dup_parent);
extern Node *adjust_inherited_attrs(Node *node,
Index old_rt_index, Oid old_relid,