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  List *groupClause,
182  List *qual,
183  double numGroups);
185  RelOptInfo *rel,
186  Path *subpath,
187  int numCols,
188  double numGroups);
189 extern AggPath *create_agg_path(PlannerInfo *root,
190  RelOptInfo *rel,
191  Path *subpath,
192  PathTarget *target,
193  AggStrategy aggstrategy,
194  AggSplit aggsplit,
195  List *groupClause,
196  List *qual,
197  const AggClauseCosts *aggcosts,
198  double numGroups);
200  RelOptInfo *rel,
201  Path *subpath,
202  List *having_qual,
203  AggStrategy aggstrategy,
204  List *rollups,
205  const AggClauseCosts *agg_costs,
206  double numGroups);
208  RelOptInfo *rel,
209  PathTarget *target,
210  List *mmaggregates,
211  List *quals);
213  RelOptInfo *rel,
214  Path *subpath,
215  PathTarget *target,
216  List *windowFuncs,
217  WindowClause *winclause,
218  List *winpathkeys);
220  RelOptInfo *rel,
221  Path *subpath,
222  SetOpCmd cmd,
223  SetOpStrategy strategy,
224  List *distinctList,
225  AttrNumber flagColIdx,
226  int firstFlag,
227  double numGroups,
228  double outputRows);
230  RelOptInfo *rel,
231  Path *leftpath,
232  Path *rightpath,
233  PathTarget *target,
234  List *distinctList,
235  int wtParam,
236  double numGroups);
238  Path *subpath, List *rowMarks, int epqParam);
240  RelOptInfo *rel,
241  CmdType operation, bool canSetTag,
242  Index nominalRelation, List *partitioned_rels,
243  bool partColsUpdated,
244  List *resultRelations, List *subpaths,
245  List *subroots,
246  List *withCheckOptionLists, List *returningLists,
247  List *rowMarks, OnConflictExpr *onconflict,
248  int epqParam);
250  Path *subpath,
251  Node *limitOffset, Node *limitCount,
252  int64 offset_est, int64 count_est);
253 
254 extern Path *reparameterize_path(PlannerInfo *root, Path *path,
255  Relids required_outer,
256  double loop_count);
258  RelOptInfo *child_rel);
259 
260 /*
261  * prototypes for relnode.c
262  */
263 extern void setup_simple_rel_arrays(PlannerInfo *root);
264 extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
265  RelOptInfo *parent);
266 extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
267 extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
269  Relids joinrelids,
270  RelOptInfo *outer_rel,
271  RelOptInfo *inner_rel,
272  SpecialJoinInfo *sjinfo,
273  List **restrictlist_ptr);
275  Relids joinrelids,
276  RelOptInfo *outer_rel,
277  RelOptInfo *inner_rel);
280  Relids relids);
282  RelOptInfo *rel);
285  RelOptInfo *baserel,
286  Relids required_outer);
288  RelOptInfo *joinrel,
289  Path *outer_path,
290  Path *inner_path,
291  SpecialJoinInfo *sjinfo,
292  Relids required_outer,
293  List **restrict_clauses);
295  Relids required_outer);
297  Relids required_outer);
299  RelOptInfo *outer_rel, RelOptInfo *inner_rel,
300  RelOptInfo *parent_joinrel, List *restrictlist,
301  SpecialJoinInfo *sjinfo, JoinType jointype);
302 
303 #endif /* PATHNODE_H */
AppendPath * create_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *partial_subpaths, Relids required_outer, int parallel_workers, bool parallel_aware, List *partitioned_rels, double rows)
Definition: pathnode.c:1219
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition: pathnode.c:954
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:3513
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2564
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:3145
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:344
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:3313
Definition: nodes.h:516
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:2002
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:2786
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:279
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1483
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition: relnode.c:1552
UpperRelationKind
Definition: relation.h:72
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition: relnode.c:815
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer, List *partitioned_rels)
Definition: pathnode.c:1347
SetOpStrategy
Definition: nodes.h:794
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:2252
JoinType
Definition: nodes.h:680
int compare_fractional_path_costs(Path *path1, Path *path2, double fraction)
Definition: pathnode.c:117
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2675
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:2062
Definition: type.h:89
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition: relnode.c:1261
bool add_partial_path_precheck(RelOptInfo *parent_rel, Cost total_cost, List *pathkeys)
Definition: pathnode.c:892
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition: pathnode.c:3207
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
Definition: pathnode.c:1522
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:1977
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1925
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1899
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:1226
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:1116
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List **restrictlist_ptr)
Definition: relnode.c:482
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, WindowClause *winclause, List *winpathkeys)
Definition: pathnode.c:3081
ScanDirection
Definition: sdir.h:22
RelOptInfo * build_empty_join_rel(PlannerInfo *root)
Definition: relnode.c:1111
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition: pathnode.c:3252
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
Definition: pathnode.c:3626
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:979
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:2131
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition: pathnode.c:1741
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:1024
unsigned int Index
Definition: c.h:442
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:2164
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3415
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:2028
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition: pathnode.c:2098
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *having_qual, AggStrategy aggstrategy, List *rollups, const AggClauseCosts *agg_costs, double numGroups)
Definition: pathnode.c:2852
AggSplit
Definition: nodes.h:764
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
Definition: pathnode.c:1083
CostSelector
Definition: relation.h:35
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:686
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:1348
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2384
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2631
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:2318
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition: pathnode.c:1832
AggStrategy
Definition: nodes.h:742
ResultPath * create_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *resconstantqual)
Definition: pathnode.c:1439
SetOpCmd
Definition: nodes.h:786
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1871
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition: pathnode.c:1188
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
Definition: relnode.c:1145
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:1581
UpperUniquePath * create_upper_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition: pathnode.c:2734
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:3009
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1951
Definition: pg_list.h:45
int16 AttrNumber
Definition: attnum.h:21
AppendRelInfo * find_childrel_appendrelinfo(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:1196
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1152
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition: pathnode.c:2475
CmdType
Definition: nodes.h:656
double Cost
Definition: nodes.h:647
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234
Path * create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)