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  Relids required_outer);
108  PathTarget *target,
109  double rows, Cost startup_cost, Cost total_cost,
110  List *pathkeys,
111  Relids required_outer,
112  Path *fdw_outerpath,
113  List *fdw_private);
114 
115 extern Relids calc_nestloop_required_outer(Relids outerrelids,
116  Relids outer_paramrels,
117  Relids innerrelids,
118  Relids inner_paramrels);
119 extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);
120 
122  RelOptInfo *joinrel,
123  JoinType jointype,
124  JoinCostWorkspace *workspace,
125  JoinPathExtraData *extra,
126  Path *outer_path,
127  Path *inner_path,
128  List *restrict_clauses,
129  List *pathkeys,
130  Relids required_outer);
131 
133  RelOptInfo *joinrel,
134  JoinType jointype,
135  JoinCostWorkspace *workspace,
136  JoinPathExtraData *extra,
137  Path *outer_path,
138  Path *inner_path,
139  List *restrict_clauses,
140  List *pathkeys,
141  Relids required_outer,
142  List *mergeclauses,
143  List *outersortkeys,
144  List *innersortkeys);
145 
147  RelOptInfo *joinrel,
148  JoinType jointype,
149  JoinCostWorkspace *workspace,
150  JoinPathExtraData *extra,
151  Path *outer_path,
152  Path *inner_path,
153  List *restrict_clauses,
154  Relids required_outer,
155  List *hashclauses);
156 
158  RelOptInfo *rel,
159  Path *subpath,
160  PathTarget *target);
162  RelOptInfo *rel,
163  Path *path,
164  PathTarget *target);
166  RelOptInfo *rel,
167  Path *subpath,
168  PathTarget *target);
170  RelOptInfo *rel,
171  Path *subpath,
172  List *pathkeys,
173  double limit_tuples);
175  RelOptInfo *rel,
176  Path *subpath,
177  PathTarget *target,
178  List *groupClause,
179  List *qual,
180  double numGroups);
182  RelOptInfo *rel,
183  Path *subpath,
184  int numCols,
185  double numGroups);
186 extern AggPath *create_agg_path(PlannerInfo *root,
187  RelOptInfo *rel,
188  Path *subpath,
189  PathTarget *target,
190  AggStrategy aggstrategy,
191  AggSplit aggsplit,
192  List *groupClause,
193  List *qual,
194  const AggClauseCosts *aggcosts,
195  double numGroups);
197  RelOptInfo *rel,
198  Path *subpath,
199  PathTarget *target,
200  List *having_qual,
201  AggStrategy aggstrategy,
202  List *rollups,
203  const AggClauseCosts *agg_costs,
204  double numGroups);
206  RelOptInfo *rel,
207  PathTarget *target,
208  List *mmaggregates,
209  List *quals);
211  RelOptInfo *rel,
212  Path *subpath,
213  PathTarget *target,
214  List *windowFuncs,
215  WindowClause *winclause,
216  List *winpathkeys);
218  RelOptInfo *rel,
219  Path *subpath,
220  SetOpCmd cmd,
221  SetOpStrategy strategy,
222  List *distinctList,
223  AttrNumber flagColIdx,
224  int firstFlag,
225  double numGroups,
226  double outputRows);
228  RelOptInfo *rel,
229  Path *leftpath,
230  Path *rightpath,
231  PathTarget *target,
232  List *distinctList,
233  int wtParam,
234  double numGroups);
236  Path *subpath, List *rowMarks, int epqParam);
238  RelOptInfo *rel,
239  CmdType operation, bool canSetTag,
240  Index nominalRelation, List *partitioned_rels,
241  List *resultRelations, List *subpaths,
242  List *subroots,
243  List *withCheckOptionLists, List *returningLists,
244  List *rowMarks, OnConflictExpr *onconflict,
245  int epqParam);
247  Path *subpath,
248  Node *limitOffset, Node *limitCount,
249  int64 offset_est, int64 count_est);
250 
251 extern Path *reparameterize_path(PlannerInfo *root, Path *path,
252  Relids required_outer,
253  double loop_count);
254 
255 /*
256  * prototypes for relnode.c
257  */
258 extern void setup_simple_rel_arrays(PlannerInfo *root);
259 extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
260  RelOptInfo *parent);
261 extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
262 extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
264  Relids joinrelids,
265  RelOptInfo *outer_rel,
266  RelOptInfo *inner_rel,
267  SpecialJoinInfo *sjinfo,
268  List **restrictlist_ptr);
270  Relids joinrelids,
271  RelOptInfo *outer_rel,
272  RelOptInfo *inner_rel);
275  Relids relids);
277  RelOptInfo *rel);
280  RelOptInfo *baserel,
281  Relids required_outer);
283  RelOptInfo *joinrel,
284  Path *outer_path,
285  Path *inner_path,
286  SpecialJoinInfo *sjinfo,
287  Relids required_outer,
288  List **restrict_clauses);
290  Relids required_outer);
292  Relids required_outer);
293 
294 #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:3373
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2446
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:3009
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:336
Definition: nodes.h:509
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1900
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:2667
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:271
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1388
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition: relnode.c:1359
UpperRelationKind
Definition: relation.h:71
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition: relnode.c:662
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer, List *partitioned_rels)
Definition: pathnode.c:1257
SetOpStrategy
Definition: nodes.h:787
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:2150
JoinType
Definition: nodes.h:673
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:3175
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:2732
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:1960
Definition: type.h:89
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition: relnode.c:1068
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:3071
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
Definition: pathnode.c:1427
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:1033
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
Definition: relnode.c:91
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:474
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, WindowClause *winclause, List *winpathkeys)
Definition: pathnode.c:2945
ScanDirection
Definition: sdir.h:22
RelOptInfo * build_empty_join_rel(PlannerInfo *root)
Definition: relnode.c:918
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition: pathnode.c:3116
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:2029
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition: pathnode.c:1639
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:359
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:2062
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3275
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1926
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition: pathnode.c:1996
AggSplit
Definition: nodes.h:757
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:1155
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2279
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2513
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition: pathnode.c:1730
AggStrategy
Definition: nodes.h:735
ResultPath * create_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *resconstantqual)
Definition: pathnode.c:1349
SetOpCmd
Definition: nodes.h:779
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:952
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
Definition: pathnode.c:752
ParamPathInfo * find_param_path_info(RelOptInfo *rel, Relids required_outer)
Definition: relnode.c:1388
UpperUniquePath * create_upper_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition: pathnode.c:2615
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:2886
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2557
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1849
Definition: pg_list.h:45
int16 AttrNumber
Definition: attnum.h:21
AppendRelInfo * find_childrel_appendrelinfo(PlannerInfo *root, RelOptInfo *rel)
Definition: relnode.c:1003
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:2370
CmdType
Definition: nodes.h:649
double Cost
Definition: nodes.h:640
HashPath * create_hashjoin_path(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, JoinCostWorkspace *workspace, JoinPathExtraData *extra, Path *outer_path, Path *inner_path, List *restrict_clauses, Relids required_outer, List *hashclauses)
Definition: pathnode.c:2215
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234
Path * create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)