]> granicus.if.org Git - postgresql/blob - src/include/optimizer/paths.h
First cut at full support for OUTER JOINs. There are still a few loose
[postgresql] / src / include / optimizer / paths.h
1 /*-------------------------------------------------------------------------
2  *
3  * paths.h
4  *        prototypes for various files in optimizer/path (were separate
5  *        header files)
6  *
7  *
8  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $Id: paths.h,v 1.47 2000/09/12 21:07:11 tgl Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef PATHS_H
16 #define PATHS_H
17
18 #include "nodes/relation.h"
19
20 /* default GEQO threshold (default value for geqo_rels) */
21 #define DEFAULT_GEQO_RELS 11
22
23
24 /*
25  * allpaths.c
26  */
27 extern bool enable_geqo;
28 extern int      geqo_rels;
29
30 extern RelOptInfo *make_one_rel(Query *root);
31
32 /*
33  * indxpath.c
34  *        routines to generate index paths
35  */
36 extern void create_index_paths(Query *root, RelOptInfo *rel, List *indices,
37                                    List *restrictinfo_list,
38                                    List *joininfo_list);
39 extern Oid indexable_operator(Expr *clause, Oid opclass, Oid relam,
40                                    bool indexkey_on_left);
41 extern List *extract_or_indexqual_conditions(RelOptInfo *rel,
42                                                                 IndexOptInfo *index,
43                                                                 Expr *orsubclause);
44 extern List *expand_indexqual_conditions(List *indexquals);
45
46 /*
47  * orindxpath.c
48  *        additional routines for indexable OR clauses
49  */
50 extern void create_or_index_paths(Query *root, RelOptInfo *rel,
51                                           List *clauses);
52
53 /*
54  * tidpath.h
55  *        routines to generate tid paths
56  */
57 extern void create_tidscan_paths(Query *root, RelOptInfo *rel);
58
59 /*
60  * joinpath.c
61  *         routines to create join paths
62  */
63 extern void add_paths_to_joinrel(Query *root, RelOptInfo *joinrel,
64                                                                  RelOptInfo *outerrel,
65                                                                  RelOptInfo *innerrel,
66                                                                  JoinType jointype,
67                                                                  List *restrictlist);
68
69 /*
70  * joinrels.c
71  *        routines to determine which relations to join
72  */
73 extern List *make_rels_by_joins(Query *root, int level, List **joinrels);
74 extern List *make_rels_by_clause_joins(Query *root,
75                                                                            RelOptInfo *old_rel,
76                                                                            List *other_rels);
77 extern List *make_rels_by_clauseless_joins(Query *root,
78                                                                                    RelOptInfo *old_rel,
79                                                                                    List *other_rels);
80 extern RelOptInfo *make_rel_from_jointree(Query *root, Node *jtnode);
81
82 /*
83  * pathkeys.c
84  *        utilities for matching and building path keys
85  */
86 typedef enum
87 {
88         PATHKEYS_EQUAL,                         /* pathkeys are identical */
89         PATHKEYS_BETTER1,                       /* pathkey 1 is a superset of pathkey 2 */
90         PATHKEYS_BETTER2,                       /* vice versa */
91         PATHKEYS_DIFFERENT                      /* neither pathkey includes the other */
92 } PathKeysComparison;
93
94 extern void add_equijoined_keys(Query *root, RestrictInfo *restrictinfo);
95 extern void generate_implied_equalities(Query *root);
96 extern List *canonicalize_pathkeys(Query *root, List *pathkeys);
97 extern PathKeysComparison compare_pathkeys(List *keys1, List *keys2);
98 extern bool pathkeys_contained_in(List *keys1, List *keys2);
99 extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
100                                                            CostSelector cost_criterion);
101 extern Path *get_cheapest_fractional_path_for_pathkeys(List *paths,
102                                                                                   List *pathkeys,
103                                                                                   double fraction);
104 extern List *build_index_pathkeys(Query *root, RelOptInfo *rel,
105                                          IndexOptInfo *index,
106                                          ScanDirection scandir);
107 extern List *build_join_pathkeys(List *outer_pathkeys,
108                                         List *join_rel_tlist,
109                                         List *equi_key_list);
110 extern List *make_pathkeys_for_sortclauses(List *sortclauses,
111                                                           List *tlist);
112 extern List *find_mergeclauses_for_pathkeys(List *pathkeys,
113                                                            List *restrictinfos);
114 extern List *make_pathkeys_for_mergeclauses(Query *root,
115                                                                                         List *mergeclauses,
116                                                                                         RelOptInfo *rel);
117
118 #endif   /* PATHS_H */