PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-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
16 
17 #include "nodes/relation.h"
18 
19 
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);
35 
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,
57  int parallel_degree);
59  RelOptInfo *rel,
60  List *bitmapquals);
62  RelOptInfo *rel,
63  List *bitmapquals);
65  List *tidquals, Relids required_outer);
66 extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths,
67  Relids required_outer, int parallel_workers,
68  List *partitioned_rels);
70  RelOptInfo *rel,
71  List *subpaths,
72  List *pathkeys,
73  Relids required_outer,
74  List *partitioned_rels);
76  PathTarget *target, List *resconstantqual);
79  Path *subpath, SpecialJoinInfo *sjinfo);
81  RelOptInfo *rel, Path *subpath, PathTarget *target,
82  Relids required_outer, double *rows);
84  RelOptInfo *rel,
85  Path *subpath,
86  PathTarget *target,
87  List *pathkeys,
88  Relids required_outer,
89  double *rows);
91  RelOptInfo *rel, Path *subpath,
92  List *pathkeys, Relids required_outer);
94  List *pathkeys, Relids required_outer);
96  List *pathkeys, Relids required_outer);
98  Relids required_outer);
100  Relids required_outer);
101 extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel,
102  Relids required_outer);
104  Relids required_outer);
106  PathTarget *target,
107  double rows, Cost startup_cost, Cost total_cost,
108  List *pathkeys,
109  Relids required_outer,
110  Path *fdw_outerpath,
111  List *fdw_private);
112 
113 extern Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path);
114 extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);
115 
117  RelOptInfo *joinrel,
118  JoinType jointype,
119  JoinCostWorkspace *workspace,
120  SpecialJoinInfo *sjinfo,
121  SemiAntiJoinFactors *semifactors,
122  Path *outer_path,
123  Path *inner_path,
124  List *restrict_clauses,
125  List *pathkeys,
126  Relids required_outer);
127 
129  RelOptInfo *joinrel,
130  JoinType jointype,
131  JoinCostWorkspace *workspace,
132  SpecialJoinInfo *sjinfo,
133  Path *outer_path,
134  Path *inner_path,
135  List *restrict_clauses,
136  List *pathkeys,
137  Relids required_outer,
138  List *mergeclauses,
139  List *outersortkeys,
140  List *innersortkeys);
141 
143  RelOptInfo *joinrel,
144  JoinType jointype,
145  JoinCostWorkspace *workspace,
146  SpecialJoinInfo *sjinfo,
147  SemiAntiJoinFactors *semifactors,
148  Path *outer_path,
149  Path *inner_path,
150  List *restrict_clauses,
151  Relids required_outer,
152  List *hashclauses);
153 
155  RelOptInfo *rel,
156  Path *subpath,
157  PathTarget *target);
159  RelOptInfo *rel,
160  Path *path,
161  PathTarget *target);
163  RelOptInfo *rel,
164  Path *subpath,
165  PathTarget *target);
167  RelOptInfo *rel,
168  Path *subpath,
169  List *pathkeys,
170  double limit_tuples);
172  RelOptInfo *rel,
173  Path *subpath,
174  PathTarget *target,
175  List *groupClause,
176  List *qual,
177  double numGroups);
179  RelOptInfo *rel,
180  Path *subpath,
181  int numCols,
182  double numGroups);
183 extern AggPath *create_agg_path(PlannerInfo *root,
184  RelOptInfo *rel,
185  Path *subpath,
186  PathTarget *target,
187  AggStrategy aggstrategy,
188  AggSplit aggsplit,
189  List *groupClause,
190  List *qual,
191  const AggClauseCosts *aggcosts,
192  double numGroups);
194  RelOptInfo *rel,
195  Path *subpath,
196  PathTarget *target,
197  List *having_qual,
198  AggStrategy aggstrategy,
199  List *rollups,
200  const AggClauseCosts *agg_costs,
201  double numGroups);
203  RelOptInfo *rel,
204  PathTarget *target,
205  List *mmaggregates,
206  List *quals);
208  RelOptInfo *rel,
209  Path *subpath,
210  PathTarget *target,
211  List *windowFuncs,
212  WindowClause *winclause,
213  List *winpathkeys);
215  RelOptInfo *rel,
216  Path *subpath,
217  SetOpCmd cmd,
218  SetOpStrategy strategy,
219  List *distinctList,
220  AttrNumber flagColIdx,
221  int firstFlag,
222  double numGroups,
223  double outputRows);
225  RelOptInfo *rel,
226  Path *leftpath,
227  Path *rightpath,
228  PathTarget *target,
229  List *distinctList,
230  int wtParam,
231  double numGroups);
233  Path *subpath, List *rowMarks, int epqParam);
235  RelOptInfo *rel,
236  CmdType operation, bool canSetTag,
237  Index nominalRelation, List *partitioned_rels,
238  List *resultRelations, List *subpaths,
239  List *subroots,
240  List *withCheckOptionLists, List *returningLists,
241  List *rowMarks, OnConflictExpr *onconflict,
242  int epqParam);
244  Path *subpath,
245  Node *limitOffset, Node *limitCount,
246  int64 offset_est, int64 count_est);
247 
248 extern Path *reparameterize_path(PlannerInfo *root, Path *path,
249  Relids required_outer,
250  double loop_count);
251 
252 /*
253  * prototypes for relnode.c
254  */
255 extern void setup_simple_rel_arrays(PlannerInfo *root);
256 extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
257  RelOptKind reloptkind);
258 extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
259 extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
261  Relids joinrelids,
262  RelOptInfo *outer_rel,
263  RelOptInfo *inner_rel,
264  SpecialJoinInfo *sjinfo,
265  List **restrictlist_ptr);
267  Relids joinrelids,
268  RelOptInfo *outer_rel,
269  RelOptInfo *inner_rel);
272  Relids relids);
274  RelOptInfo *rel);
278  RelOptInfo *baserel,
279  Relids required_outer);
281  RelOptInfo *joinrel,
282  Path *outer_path,
283  Path *inner_path,
284  SpecialJoinInfo *sjinfo,
285  Relids required_outer,
286  List **restrict_clauses);
288  Relids required_outer);
289 
290 #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:62
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
Definition: pathnode.c:3343
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2419
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:2982
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:288
Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:1970
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:2188
RelOptKind
Definition: relation.h:478
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:2124
Definition: nodes.h:506
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:2640
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:223
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1389
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition: relnode.c:1334
UpperRelationKind
Definition: relation.h:71
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition: relnode.c:605
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer, List *partitioned_rels)
Definition: pathnode.c:1258
RelOptInfo * find_childrel_top_parent(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:976
SetOpStrategy
Definition: nodes.h:783
JoinType
Definition: nodes.h:669
ModifyTablePath * create_modifytable_path(PlannerInfo *root, RelOptInfo *rel, CmdType operation, bool canSetTag, Index nominalRelation, List *partitioned_rels, List *resultRelations, List *subpaths, List *subroots, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, int epqParam)
Definition: pathnode.c:3145
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:2705
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:1934
Definition: type.h:90
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition: relnode.c:1035
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:3044
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
Definition: pathnode.c:1428
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:1875
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1823
AppendPath * create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer, int parallel_workers, List *partitioned_rels)
Definition: pathnode.c:1203
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1797
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:1002
void set_cheapest(RelOptInfo *parent_rel)
Definition: pathnode.c:234
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1100
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List **restrictlist_ptr)
Definition: relnode.c:426
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, WindowClause *winclause, List *winpathkeys)
Definition: pathnode.c:2918
ScanDirection
Definition: sdir.h:22
RelOptInfo * build_empty_join_rel(PlannerInfo *root)
Definition: relnode.c:861
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition: pathnode.c:3089
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:2002
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
Definition: relnode.c:91
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition: pathnode.c:1640
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:365
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3245
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1900
AggSplit
Definition: nodes.h:753
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
Definition: pathnode.c:1067
CostSelector
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:1126
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2252
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2486
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition: pathnode.c:1731
AggStrategy
Definition: nodes.h:731
ResultPath * create_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *resconstantqual)
Definition: pathnode.c:1350
SetOpCmd
Definition: nodes.h:775
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1769
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition: pathnode.c:1172
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
Definition: relnode.c:895
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:2588
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:2859
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2530
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1849
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:2036
Definition: pg_list.h:45
int16 AttrNumber
Definition: attnum.h:21
AppendRelInfo * find_childrel_appendrelinfo(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:946
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1136
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition: pathnode.c:2343
CmdType
Definition: nodes.h:645
Definition: relation.h:911
double Cost
Definition: nodes.h:636
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234
Path * create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)