PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * pathnode.h
4  * prototypes for pathnode.c, relnode.c.
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/pathnode.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PATHNODE_H
15 #define PATHNODE_H
17 #include "nodes/relation.h"
20 /*
21  * prototypes for pathnode.c
22  */
23 extern int compare_path_costs(Path *path1, Path *path2,
24  CostSelector criterion);
25 extern int compare_fractional_path_costs(Path *path1, Path *path2,
26  double fraction);
27 extern void set_cheapest(RelOptInfo *parent_rel);
28 extern void add_path(RelOptInfo *parent_rel, Path *new_path);
29 extern bool add_path_precheck(RelOptInfo *parent_rel,
30  Cost startup_cost, Cost total_cost,
31  List *pathkeys, Relids required_outer);
32 extern void add_partial_path(RelOptInfo *parent_rel, Path *new_path);
33 extern bool add_partial_path_precheck(RelOptInfo *parent_rel,
34  Cost total_cost, List *pathkeys);
37  Relids required_outer, int parallel_workers);
39  Relids required_outer);
42  List *indexclauses,
43  List *indexclausecols,
44  List *indexorderbys,
45  List *indexorderbycols,
46  List *pathkeys,
47  ScanDirection indexscandir,
48  bool indexonly,
49  Relids required_outer,
50  double loop_count,
51  bool partial_path);
53  RelOptInfo *rel,
54  Path *bitmapqual,
55  Relids required_outer,
56  double loop_count);
58  RelOptInfo *rel,
59  List *bitmapquals);
61  RelOptInfo *rel,
62  List *bitmapquals);
64  List *tidquals, Relids required_outer);
65 extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths,
66  Relids required_outer, int parallel_workers);
68  RelOptInfo *rel,
69  List *subpaths,
70  List *pathkeys,
71  Relids required_outer);
73  PathTarget *target, List *resconstantqual);
76  Path *subpath, SpecialJoinInfo *sjinfo);
78  RelOptInfo *rel, Path *subpath, PathTarget *target,
79  Relids required_outer, double *rows);
81  RelOptInfo *rel, Path *subpath,
82  List *pathkeys, Relids required_outer);
84  List *pathkeys, Relids required_outer);
86  Relids required_outer);
88  Relids required_outer);
90  Relids required_outer);
92  PathTarget *target,
93  double rows, Cost startup_cost, Cost total_cost,
94  List *pathkeys,
95  Relids required_outer,
96  Path *fdw_outerpath,
97  List *fdw_private);
99 extern Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path);
100 extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);
103  RelOptInfo *joinrel,
104  JoinType jointype,
105  JoinCostWorkspace *workspace,
106  SpecialJoinInfo *sjinfo,
107  SemiAntiJoinFactors *semifactors,
108  Path *outer_path,
109  Path *inner_path,
110  List *restrict_clauses,
111  List *pathkeys,
112  Relids required_outer);
115  RelOptInfo *joinrel,
116  JoinType jointype,
117  JoinCostWorkspace *workspace,
118  SpecialJoinInfo *sjinfo,
119  Path *outer_path,
120  Path *inner_path,
121  List *restrict_clauses,
122  List *pathkeys,
123  Relids required_outer,
124  List *mergeclauses,
125  List *outersortkeys,
126  List *innersortkeys);
129  RelOptInfo *joinrel,
130  JoinType jointype,
131  JoinCostWorkspace *workspace,
132  SpecialJoinInfo *sjinfo,
133  SemiAntiJoinFactors *semifactors,
134  Path *outer_path,
135  Path *inner_path,
136  List *restrict_clauses,
137  Relids required_outer,
138  List *hashclauses);
141  RelOptInfo *rel,
142  Path *subpath,
143  PathTarget *target);
145  RelOptInfo *rel,
146  Path *path,
147  PathTarget *target);
149  RelOptInfo *rel,
150  Path *subpath,
151  PathTarget *target);
153  RelOptInfo *rel,
154  Path *subpath,
155  List *pathkeys,
156  double limit_tuples);
158  RelOptInfo *rel,
159  Path *subpath,
160  PathTarget *target,
161  List *groupClause,
162  List *qual,
163  double numGroups);
165  RelOptInfo *rel,
166  Path *subpath,
167  int numCols,
168  double numGroups);
169 extern AggPath *create_agg_path(PlannerInfo *root,
170  RelOptInfo *rel,
171  Path *subpath,
172  PathTarget *target,
173  AggStrategy aggstrategy,
174  AggSplit aggsplit,
175  List *groupClause,
176  List *qual,
177  const AggClauseCosts *aggcosts,
178  double numGroups);
180  RelOptInfo *rel,
181  Path *subpath,
182  PathTarget *target,
183  List *having_qual,
184  List *rollup_lists,
185  List *rollup_groupclauses,
186  const AggClauseCosts *agg_costs,
187  double numGroups);
189  RelOptInfo *rel,
190  PathTarget *target,
191  List *mmaggregates,
192  List *quals);
194  RelOptInfo *rel,
195  Path *subpath,
196  PathTarget *target,
197  List *windowFuncs,
198  WindowClause *winclause,
199  List *winpathkeys);
201  RelOptInfo *rel,
202  Path *subpath,
203  SetOpCmd cmd,
204  SetOpStrategy strategy,
205  List *distinctList,
206  AttrNumber flagColIdx,
207  int firstFlag,
208  double numGroups,
209  double outputRows);
211  RelOptInfo *rel,
212  Path *leftpath,
213  Path *rightpath,
214  PathTarget *target,
215  List *distinctList,
216  int wtParam,
217  double numGroups);
219  Path *subpath, List *rowMarks, int epqParam);
221  RelOptInfo *rel,
222  CmdType operation, bool canSetTag,
223  Index nominalRelation,
224  List *resultRelations, List *subpaths,
225  List *subroots,
226  List *withCheckOptionLists, List *returningLists,
227  List *rowMarks, OnConflictExpr *onconflict,
228  int epqParam);
230  Path *subpath,
231  Node *limitOffset, Node *limitCount,
232  int64 offset_est, int64 count_est);
234 extern Path *reparameterize_path(PlannerInfo *root, Path *path,
235  Relids required_outer,
236  double loop_count);
238 /*
239  * prototypes for relnode.c
240  */
241 extern void setup_simple_rel_arrays(PlannerInfo *root);
242 extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
243  RelOptKind reloptkind);
244 extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
245 extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
247  Relids joinrelids,
248  RelOptInfo *outer_rel,
249  RelOptInfo *inner_rel,
250  SpecialJoinInfo *sjinfo,
251  List **restrictlist_ptr);
253  Relids joinrelids,
254  RelOptInfo *outer_rel,
255  RelOptInfo *inner_rel);
258  Relids relids);
260  RelOptInfo *rel);
264  RelOptInfo *baserel,
265  Relids required_outer);
267  RelOptInfo *joinrel,
268  Path *outer_path,
269  Path *inner_path,
270  SpecialJoinInfo *sjinfo,
271  Relids required_outer,
272  List **restrict_clauses);
274  Relids required_outer);
276 #endif /* PATHNODE_H */
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition: pathnode.c:938
bool add_path_precheck(RelOptInfo *parent_rel, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer)
Definition: pathnode.c:647
void add_path(RelOptInfo *parent_rel, Path *new_path)
Definition: pathnode.c:412
void setup_simple_rel_arrays(PlannerInfo *root)
Definition: relnode.c:59
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
Definition: pathnode.c:3216
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2329
SetOpPath * create_setop_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SetOpCmd cmd, SetOpStrategy strategy, List *distinctList, AttrNumber flagColIdx, int firstFlag, double numGroups, double outputRows)
Definition: pathnode.c:2856
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:284
Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:1880
HashPath * create_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors, Path *outer_path, Path *inner_path, List *restrict_clauses, Relids required_outer, List *hashclauses)
Definition: pathnode.c:2098
ModifyTablePath * create_modifytable_path(PlannerInfo *root, RelOptInfo *rel, CmdType operation, bool canSetTag, Index nominalRelation, List *resultRelations, List *subpaths, List *subroots, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, int epqParam)
Definition: pathnode.c:3019
Definition: relation.h:474
MergePath * create_mergejoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer, List *mergeclauses, List *outersortkeys, List *innersortkeys)
Definition: pathnode.c:2034
Definition: nodes.h:508
AggPath * create_agg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, AggStrategy aggstrategy, AggSplit aggsplit, List *groupClause, List *qual, const AggClauseCosts *aggcosts, double numGroups)
Definition: pathnode.c:2550
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:219
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1385
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition: relnode.c:1309
Definition: relation.h:71
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition: relnode.c:580
RelOptInfo * find_childrel_top_parent(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:951
Definition: nodes.h:778
Definition: nodes.h:665
int compare_fractional_path_costs(Path *path1, Path *path2, double fraction)
Definition: pathnode.c:107
ForeignPath * create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, double rows, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer, Path *fdw_outerpath, List *fdw_private)
Definition: pathnode.c:1844
Definition: type.h:90
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition: relnode.c:1010
bool add_partial_path_precheck(RelOptInfo *parent_rel, Cost total_cost, List *pathkeys)
Definition: pathnode.c:876
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition: pathnode.c:2918
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
Definition: pathnode.c:1424
int compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
Definition: pathnode.c:61
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1785
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1733
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:977
void set_cheapest(RelOptInfo *parent_rel)
Definition: pathnode.c:234
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1099
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List **restrictlist_ptr)
Definition: relnode.c:346
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count)
Definition: pathnode.c:1067
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, WindowClause *winclause, List *winpathkeys)
Definition: pathnode.c:2792
Definition: sdir.h:22
RelOptInfo * build_empty_join_rel(PlannerInfo *root)
Definition: relnode.c:836
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition: pathnode.c:2963
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:963
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:1912
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
Definition: relnode.c:88
IndexPath * create_index_path(PlannerInfo *root, IndexOptInfo *index, List *indexclauses, List *indexclausecols, List *indexorderbys, List *indexorderbycols, List *pathkeys, ScanDirection indexscandir, bool indexonly, Relids required_outer, double loop_count, bool partial_path)
Definition: pathnode.c:1008
unsigned int Index
Definition: c.h:362
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3118
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1810
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1256
Definition: nodes.h:748
Definition: relation.h:34
ParamPathInfo * get_joinrel_parampathinfo(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, Relids required_outer, List **restrict_clauses)
Definition: relnode.c:1101
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2162
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2396
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition: pathnode.c:1667
Definition: nodes.h:727
ResultPath * create_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *resconstantqual)
Definition: pathnode.c:1346
Definition: nodes.h:770
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1705
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *having_qual, List *rollup_lists, List *rollup_groupclauses, const AggClauseCosts *agg_costs, double numGroups)
Definition: pathnode.c:2616
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition: pathnode.c:1171
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
Definition: relnode.c:870
AppendPath * create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer, int parallel_workers)
Definition: pathnode.c:1202
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
Definition: pathnode.c:752
UpperUniquePath * create_upper_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition: pathnode.c:2498
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:2733
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2440
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1759
NestPath * create_nestloop_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, SpecialJoinInfo *sjinfo, SemiAntiJoinFactors *semifactors, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1946
Definition: pg_list.h:45
int16 AttrNumber
Definition: attnum.h:21
AppendRelInfo * find_childrel_appendrelinfo(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:921
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1135
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition: pathnode.c:2253
Definition: nodes.h:641
Definition: relation.h:888
double Cost
Definition: nodes.h:632
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234