PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
planmain.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * planmain.h
4  * prototypes for various files in optimizer/plan
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/optimizer/planmain.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PLANMAIN_H
15 #define PLANMAIN_H
16 
17 #include "nodes/plannodes.h"
18 #include "nodes/relation.h"
19 
20 /* possible values for force_parallel_mode */
21 typedef enum
22 {
27 
28 /* GUC parameters */
29 #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1
30 extern double cursor_tuple_fraction;
31 extern int force_parallel_mode;
32 
33 /* query_planner callback to compute query_pathkeys */
34 typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
35 
36 /*
37  * prototypes for plan/planmain.c
38  */
39 extern RelOptInfo *query_planner(PlannerInfo *root, List *tlist,
40  query_pathkeys_callback qp_callback, void *qp_extra);
41 
42 /*
43  * prototypes for plan/planagg.c
44  */
45 extern void preprocess_minmax_aggregates(PlannerInfo *root, List *tlist);
46 
47 /*
48  * prototypes for plan/createplan.c
49  */
50 extern Plan *create_plan(PlannerInfo *root, Path *best_path);
51 extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
52  Index scanrelid, List *fdw_exprs, List *fdw_private,
53  List *fdw_scan_tlist, List *fdw_recheck_quals,
54  Plan *outer_plan);
55 extern Plan *materialize_finished_plan(Plan *subplan);
56 extern bool is_projection_capable_path(Path *path);
57 extern bool is_projection_capable_plan(Plan *plan);
58 
59 /* External use of these functions is deprecated: */
60 extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree);
61 extern Agg *make_agg(List *tlist, List *qual,
62  AggStrategy aggstrategy, AggSplit aggsplit,
63  int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
64  List *groupingSets, List *chain,
65  double dNumGroups, Plan *lefttree);
66 extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount);
67 
68 /*
69  * prototypes for plan/initsplan.c
70  */
71 extern int from_collapse_limit;
72 extern int join_collapse_limit;
73 
74 extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode);
75 extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist);
76 extern void add_vars_to_targetlist(PlannerInfo *root, List *vars,
77  Relids where_needed, bool create_new_ph);
78 extern void find_lateral_references(PlannerInfo *root);
79 extern void create_lateral_join_info(PlannerInfo *root);
82  RestrictInfo *restrictinfo);
83 extern void process_implied_equality(PlannerInfo *root,
84  Oid opno,
85  Oid collation,
86  Expr *item1,
87  Expr *item2,
88  Relids qualscope,
89  Relids nullable_relids,
90  Index security_level,
91  bool below_outer_join,
92  bool both_const);
94  Oid collation,
95  Expr *item1,
96  Expr *item2,
97  Relids qualscope,
98  Relids nullable_relids,
99  Index security_level);
100 extern void match_foreign_keys_to_quals(PlannerInfo *root);
101 
102 /*
103  * prototypes for plan/analyzejoins.c
104  */
105 extern List *remove_useless_joins(PlannerInfo *root, List *joinlist);
106 extern bool query_supports_distinctness(Query *query);
107 extern bool query_is_distinct_for(Query *query, List *colnos, List *opids);
108 
109 /*
110  * prototypes for plan/setrefs.c
111  */
112 extern Plan *set_plan_references(PlannerInfo *root, Plan *plan);
113 extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid);
114 extern void extract_query_dependencies(Node *query,
115  List **relationOids,
116  List **invalItems,
117  bool *hasRowSecurity);
118 
119 #endif /* PLANMAIN_H */
bool is_projection_capable_plan(Plan *plan)
Definition: createplan.c:6479
void distribute_restrictinfo_to_rels(PlannerInfo *root, RestrictInfo *restrictinfo)
Definition: initsplan.c:2205
void create_lateral_join_info(PlannerInfo *root)
Definition: initsplan.c:417
void build_base_rel_tlists(PlannerInfo *root, List *final_tlist)
Definition: initsplan.c:150
Plan * create_plan(PlannerInfo *root, Path *best_path)
Definition: createplan.c:300
Limit * make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount)
Definition: createplan.c:6236
void match_foreign_keys_to_quals(PlannerInfo *root)
Definition: initsplan.c:2412
bool is_projection_capable_path(Path *path)
Definition: createplan.c:6434
Agg * make_agg(List *tlist, List *qual, AggStrategy aggstrategy, AggSplit aggsplit, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, List *groupingSets, List *chain, double dNumGroups, Plan *lefttree)
Definition: createplan.c:5899
Definition: nodes.h:506
void record_plan_function_dependency(PlannerInfo *root, Oid funcid)
Definition: setrefs.c:2473
unsigned int Oid
Definition: postgres_ext.h:31
void process_implied_equality(PlannerInfo *root, Oid opno, Oid collation, Expr *item1, Expr *item2, Relids qualscope, Relids nullable_relids, Index security_level, bool below_outer_join, bool both_const)
Definition: initsplan.c:2289
ForceParallelMode
Definition: planmain.h:21
void add_base_rels_to_query(PlannerInfo *root, Node *jtnode)
Definition: initsplan.c:104
int from_collapse_limit
Definition: initsplan.c:36
int join_collapse_limit
Definition: initsplan.c:37
void preprocess_minmax_aggregates(PlannerInfo *root, List *tlist)
Definition: planagg.c:75
int force_parallel_mode
Definition: planner.c:63
Sort * make_sort_from_sortclauses(List *sortcls, Plan *lefttree)
Definition: createplan.c:5754
bool query_supports_distinctness(Query *query)
Definition: analyzejoins.c:650
List * remove_useless_joins(PlannerInfo *root, List *joinlist)
Definition: analyzejoins.c:55
unsigned int Index
Definition: c.h:365
void(* query_pathkeys_callback)(PlannerInfo *root, void *extra)
Definition: planmain.h:34
void find_lateral_references(PlannerInfo *root)
Definition: initsplan.c:271
void extract_query_dependencies(Node *query, List **relationOids, List **invalItems, bool *hasRowSecurity)
Definition: setrefs.c:2511
void add_vars_to_targetlist(PlannerInfo *root, List *vars, Relids where_needed, bool create_new_ph)
Definition: initsplan.c:197
double cursor_tuple_fraction
Definition: planner.c:62
Plan * materialize_finished_plan(Plan *subplan)
Definition: createplan.c:5866
AggSplit
Definition: nodes.h:753
RestrictInfo * build_implied_join_equality(Oid opno, Oid collation, Expr *item1, Expr *item2, Relids qualscope, Relids nullable_relids, Index security_level)
Definition: initsplan.c:2354
AggStrategy
Definition: nodes.h:731
Plan * set_plan_references(PlannerInfo *root, Plan *plan)
Definition: setrefs.c:209
bool query_is_distinct_for(Query *query, List *colnos, List *opids)
Definition: analyzejoins.c:687
ForeignScan * make_foreignscan(List *qptlist, List *qpqual, Index scanrelid, List *fdw_exprs, List *fdw_private, List *fdw_scan_tlist, List *fdw_recheck_quals, Plan *outer_plan)
Definition: createplan.c:5143
Definition: plannodes.h:751
RelOptInfo * query_planner(PlannerInfo *root, List *tlist, query_pathkeys_callback qp_callback, void *qp_extra)
Definition: planmain.c:54
Definition: regcomp.c:224
Definition: pg_list.h:45
List * deconstruct_jointree(PlannerInfo *root)
Definition: initsplan.c:692
int16 AttrNumber
Definition: attnum.h:21
Definition: relation.h:911