aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plancat.h
blob: 426778577deabb3bcd235bdde374029a14f5118a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*-------------------------------------------------------------------------
 *
 * plancat.h--
 *    prototypes for plancat.c.
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 * $Id: plancat.h,v 1.1.1.1 1996/07/09 06:21:34 scrappy Exp $
 *
 *-------------------------------------------------------------------------
 */
#ifndef PLANCAT_H
#define PLANCAT_H

#include "c.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);
extern List *VersionGetParents(Oid verrelid);

#endif /* PLANCAT_H */