* prototypes for plancat.c.
*
*
- * Copyright (c) 1994, Regents of the University of California
+ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: plancat.h,v 1.12 1999/07/15 23:03:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/plancat.h,v 1.54 2009/06/11 14:49:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PLANCAT_H
#define PLANCAT_H
-#include "nodes/parsenodes.h"
+#include "nodes/relation.h"
+#include "utils/relcache.h"
-/*
- * 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;
-
-
-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);
-
-extern Cost join_selectivity(Oid functionObjectId, Oid operatorObjectId,
- Oid relationObjectId1, AttrNumber attributeNumber1,
- Oid relationObjectId2, AttrNumber attributeNumber2);
-
-extern List *find_inheritance_children(Oid inhparent);
-
-#endif /* PLANCAT_H */
+/* Hook for plugins to get control in get_relation_info() */
+typedef void (*get_relation_info_hook_type) (PlannerInfo *root,
+ Oid relationObjectId,
+ bool inhparent,
+ RelOptInfo *rel);
+extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook;
+
+
+extern void get_relation_info(PlannerInfo *root, Oid relationObjectId,
+ bool inhparent, RelOptInfo *rel);
+
+extern void estimate_rel_size(Relation rel, int32 *attr_widths,
+ BlockNumber *pages, double *tuples);
+
+extern bool relation_excluded_by_constraints(PlannerInfo *root,
+ RelOptInfo *rel, RangeTblEntry *rte);
+
+extern List *build_physical_tlist(PlannerInfo *root, RelOptInfo *rel);
+
+extern bool has_unique_index(RelOptInfo *rel, AttrNumber attno);
+
+extern Selectivity restriction_selectivity(PlannerInfo *root,
+ Oid operator,
+ List *args,
+ int varRelid);
+
+extern Selectivity join_selectivity(PlannerInfo *root,
+ Oid operator,
+ List *args,
+ JoinType jointype,
+ SpecialJoinInfo *sjinfo);
+
+#endif /* PLANCAT_H */