PostgreSQL Source Code  git master
pathnode.h
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-2018, 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
16 
17 #include "nodes/bitmapset.h"
18 #include "nodes/relation.h"
19 
20 
21 /*
22  * prototypes for pathnode.c
23  */
24 extern int compare_path_costs(Path *path1, Path *path2,
25  CostSelector criterion);
26 extern int compare_fractional_path_costs(Path *path1, Path *path2,
27  double fraction);
28 extern void set_cheapest(RelOptInfo *parent_rel);
29 extern void add_path(RelOptInfo *parent_rel, Path *new_path);
30 extern bool add_path_precheck(RelOptInfo *parent_rel,
31  Cost startup_cost, Cost total_cost,
32  List *pathkeys, Relids required_outer);
33 extern void add_partial_path(RelOptInfo *parent_rel, Path *new_path);
34 extern bool add_partial_path_precheck(RelOptInfo *parent_rel,
35  Cost total_cost, List *pathkeys);
36 
38  Relids required_outer, int parallel_workers);
40  Relids required_outer);
43  List *indexclauses,
44  List *indexclausecols,
45  List *indexorderbys,
46  List *indexorderbycols,
47  List *pathkeys,
48  ScanDirection indexscandir,
49  bool indexonly,
50  Relids required_outer,
51  double loop_count,
52  bool partial_path);
54  RelOptInfo *rel,
55  Path *bitmapqual,
56  Relids required_outer,
57  double loop_count,
58  int parallel_degree);
60  RelOptInfo *rel,
61  List *bitmapquals);
63  RelOptInfo *rel,
64  List *bitmapquals);
66  List *tidquals, Relids required_outer);
68  List *subpaths, List *partial_subpaths,
69  Relids required_outer,
70  int parallel_workers, bool parallel_aware,
71  List *partitioned_rels, double rows);
73  RelOptInfo *rel,
74  List *subpaths,
75  List *pathkeys,
76  Relids required_outer,
77  List *partitioned_rels);
79  PathTarget *target, List *resconstantqual);
82  Path *subpath, SpecialJoinInfo *sjinfo);
84  RelOptInfo *rel, Path *subpath, PathTarget *target,
85  Relids required_outer, double *rows);
87  RelOptInfo *rel,
88  Path *subpath,
89  PathTarget *target,
90  List *pathkeys,
91  Relids required_outer,
92  double *rows);
94  RelOptInfo *rel, Path *subpath,
95  List *pathkeys, Relids required_outer);
97  List *pathkeys, Relids required_outer);
99  List *pathkeys, Relids required_outer);
101  Relids required_outer);
103  Relids required_outer);
104 extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel,
105  Relids required_outer);
107  Relids required_outer);
109  Relids required_outer);
111  PathTarget *target,
112  double rows, Cost startup_cost, Cost total_cost,
113  List *pathkeys,
114  Relids required_outer,
115  Path *fdw_outerpath,
116  List *fdw_private);
117 
118 extern Relids calc_nestloop_required_outer(Relids outerrelids,
119  Relids outer_paramrels,
120  Relids innerrelids,
121  Relids inner_paramrels);
122 extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);
123 
125  RelOptInfo *joinrel,
126  JoinType jointype,
127  JoinCostWorkspace *workspace,
128  JoinPathExtraData *extra,
129  Path *outer_path,
130  Path *inner_path,
131  List *restrict_clauses,
132  List *pathkeys,
133  Relids required_outer);
134 
136  RelOptInfo *joinrel,
137  JoinType jointype,
138  JoinCostWorkspace *workspace,
139  JoinPathExtraData *extra,
140  Path *outer_path,
141  Path *inner_path,
142  List *restrict_clauses,
143  List *pathkeys,
144  Relids required_outer,
145  List *mergeclauses,
146  List *outersortkeys,
147  List *innersortkeys);
148 
150  RelOptInfo *joinrel,
151  JoinType jointype,
152  JoinCostWorkspace *workspace,
153  JoinPathExtraData *extra,
154  Path *outer_path,
155  Path *inner_path,
156  bool parallel_hash,
157  List *restrict_clauses,
158  Relids required_outer,
159  List *hashclauses);
160 
162  RelOptInfo *rel,
163  Path *subpath,
164  PathTarget *target);
166  RelOptInfo *rel,
167  Path *path,
168  PathTarget *target);
170  RelOptInfo *rel,
171  Path *subpath,
172  PathTarget *target);
174  RelOptInfo *rel,
175  Path *subpath,
176  List *pathkeys,
177  double limit_tuples);
179  RelOptInfo *rel,
180  Path *subpath,
181  PathTarget *target,
182  List *groupClause,
183  List *qual,
184  double numGroups);
186  RelOptInfo *rel,
187  Path *subpath,
188  int numCols,
189  double numGroups);
190 extern AggPath *create_agg_path(PlannerInfo *root,
191  RelOptInfo *rel,
192  Path *subpath,
193  PathTarget *target,
194  AggStrategy aggstrategy,
195  AggSplit aggsplit,
196  List *groupClause,
197  List *qual,
198  const AggClauseCosts *aggcosts,
199  double numGroups);
201  RelOptInfo *rel,
202  Path *subpath,
203  PathTarget *target,
204  List *having_qual,
205  AggStrategy aggstrategy,
206  List *rollups,
207  const AggClauseCosts *agg_costs,
208  double numGroups);
210  RelOptInfo *rel,
211  PathTarget *target,
212  List *mmaggregates,
213  List *quals);
215  RelOptInfo *rel,
216  Path *subpath,
217  PathTarget *target,
218  List *windowFuncs,
219  WindowClause *winclause,
220  List *winpathkeys);
222  RelOptInfo *rel,
223  Path *subpath,
224  SetOpCmd cmd,
225  SetOpStrategy strategy,
226  List *distinctList,
227  AttrNumber flagColIdx,
228  int firstFlag,
229  double numGroups,
230  double outputRows);
232  RelOptInfo *rel,
233  Path *leftpath,
234  Path *rightpath,
235  PathTarget *target,
236  List *distinctList,
237  int wtParam,
238  double numGroups);
240  Path *subpath, List *rowMarks, int epqParam);
242  RelOptInfo *rel,
243  CmdType operation, bool canSetTag,
244  Index nominalRelation, List *partitioned_rels,
245  bool partColsUpdated,
246  List *resultRelations, List *subpaths,
247  List *subroots,
248  List *withCheckOptionLists, List *returningLists,
249  List *rowMarks, OnConflictExpr *onconflict,
250  int epqParam);
252  Path *subpath,
253  Node *limitOffset, Node *limitCount,
254  int64 offset_est, int64 count_est);
255 
256 extern Path *reparameterize_path(PlannerInfo *root, Path *path,
257  Relids required_outer,
258  double loop_count);
260  RelOptInfo *child_rel);
261 
262 /*
263  * prototypes for relnode.c
264  */
265 extern void setup_simple_rel_arrays(PlannerInfo *root);
266 extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
267  RelOptInfo *parent);
268 extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
269 extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
271  Relids joinrelids,
272  RelOptInfo *outer_rel,
273  RelOptInfo *inner_rel,
274  SpecialJoinInfo *sjinfo,
275  List **restrictlist_ptr);
277  Relids joinrelids,
278  RelOptInfo *outer_rel,
279  RelOptInfo *inner_rel);
282  Relids relids);
284  RelOptInfo *rel);
287  RelOptInfo *baserel,
288  Relids required_outer);
290  RelOptInfo *joinrel,
291  Path *outer_path,
292  Path *inner_path,
293  SpecialJoinInfo *sjinfo,
294  Relids required_outer,
295  List **restrict_clauses);
297  Relids required_outer);
299  Relids required_outer);
301  RelOptInfo *outer_rel, RelOptInfo *inner_rel,
302  RelOptInfo *parent_joinrel, List *restrictlist,
303  SpecialJoinInfo *sjinfo, JoinType jointype);
304 
305 #endif /* PATHNODE_H */
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition: pathnode.c:948
bool add_path_precheck(RelOptInfo *parent_rel, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer)
Definition: pathnode.c:657
void add_path(RelOptInfo *parent_rel, Path *new_path)
Definition: pathnode.c:422
void setup_simple_rel_arrays(PlannerInfo *root)
Definition: relnode.c:67
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
Definition: pathnode.c:3489
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2540
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:3121
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:342
ModifyTablePath * create_modifytable_path(PlannerInfo *root, RelOptInfo *rel, CmdType operation, bool canSetTag, Index nominalRelation, List *partitioned_rels, bool partColsUpdated, List *resultRelations, List *subpaths, List *subroots, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, int epqParam)
Definition: pathnode.c:3289
Definition: nodes.h:513
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1978
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:2762
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:277
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1459
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition: relnode.c:1544
UpperRelationKind
Definition: relation.h:71
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition: relnode.c:807
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer, List *partitioned_rels)
Definition: pathnode.c:1323
SetOpStrategy
Definition: nodes.h:791
MergePath * create_mergejoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer, List *mergeclauses, List *outersortkeys, List *innersortkeys)
Definition: pathnode.c:2228
JoinType
Definition: nodes.h:677
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *having_qual, AggStrategy aggstrategy, List *rollups, const AggClauseCosts *agg_costs, double numGroups)
Definition: pathnode.c:2828
int compare_fractional_path_costs(Path *path1, Path *path2, double fraction)
Definition: pathnode.c:117
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:2038
Definition: type.h:89
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition: relnode.c:1253
bool add_partial_path_precheck(RelOptInfo *parent_rel, Cost total_cost, List *pathkeys)
Definition: pathnode.c:886
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition: pathnode.c:3183
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
Definition: pathnode.c:1498
int compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
Definition: pathnode.c:71
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1953
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1901
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1875
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:1218
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
Definition: relnode.c:96
void set_cheapest(RelOptInfo *parent_rel)
Definition: pathnode.c:244
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1110
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List **restrictlist_ptr)
Definition: relnode.c:480
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, WindowClause *winclause, List *winpathkeys)
Definition: pathnode.c:3057
ScanDirection
Definition: sdir.h:22
RelOptInfo * build_empty_join_rel(PlannerInfo *root)
Definition: relnode.c:1103
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition: pathnode.c:3228
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
Definition: pathnode.c:3602
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:973
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:2107
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition: pathnode.c:1717
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:1018
unsigned int Index
Definition: c.h:431
NestPath * create_nestloop_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, List *restrict_clauses, List *pathkeys, Relids required_outer)
Definition: pathnode.c:2140
AppendPath * create_append_path(RelOptInfo *rel, List *subpaths, List *partial_subpaths, Relids required_outer, int parallel_workers, bool parallel_aware, List *partitioned_rels, double rows)
Definition: pathnode.c:1213
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3391
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:2004
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition: pathnode.c:2074
AggSplit
Definition: nodes.h:761
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
Definition: pathnode.c:1077
CostSelector
Definition: relation.h:34
RelOptInfo * build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel, RelOptInfo *parent_joinrel, List *restrictlist, SpecialJoinInfo *sjinfo, JoinType jointype)
Definition: relnode.c:682
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:1340
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2360
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2607
HashPath * create_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, bool parallel_hash, List *restrict_clauses, Relids required_outer, List *hashclauses)
Definition: pathnode.c:2294
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition: pathnode.c:1808
AggStrategy
Definition: nodes.h:739
ResultPath * create_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *resconstantqual)
Definition: pathnode.c:1415
SetOpCmd
Definition: nodes.h:783
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1847
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition: pathnode.c:1182
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
Definition: relnode.c:1137
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
Definition: pathnode.c:762
ParamPathInfo * find_param_path_info(RelOptInfo *rel, Relids required_outer)
Definition: relnode.c:1573
UpperUniquePath * create_upper_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition: pathnode.c:2710
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:2985
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2651
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1927
Definition: pg_list.h:45
int16 AttrNumber
Definition: attnum.h:21
AppendRelInfo * find_childrel_appendrelinfo(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:1188
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1146
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition: pathnode.c:2451
CmdType
Definition: nodes.h:653
double Cost
Definition: nodes.h:644
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234
Path * create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)