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(Path *outer_path, Path *inner_path);
116 extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);
117 
119  RelOptInfo *joinrel,
120  JoinType jointype,
121  JoinCostWorkspace *workspace,
122  JoinPathExtraData *extra,
123  Path *outer_path,
124  Path *inner_path,
125  List *restrict_clauses,
126  List *pathkeys,
127  Relids required_outer);
128 
130  RelOptInfo *joinrel,
131  JoinType jointype,
132  JoinCostWorkspace *workspace,
133  JoinPathExtraData *extra,
134  Path *outer_path,
135  Path *inner_path,
136  List *restrict_clauses,
137  List *pathkeys,
138  Relids required_outer,
139  List *mergeclauses,
140  List *outersortkeys,
141  List *innersortkeys);
142 
144  RelOptInfo *joinrel,
145  JoinType jointype,
146  JoinCostWorkspace *workspace,
147  JoinPathExtraData *extra,
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  RelOptInfo *parent);
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);
277  RelOptInfo *baserel,
278  Relids required_outer);
280  RelOptInfo *joinrel,
281  Path *outer_path,
282  Path *inner_path,
283  SpecialJoinInfo *sjinfo,
284  Relids required_outer,
285  List **restrict_clauses);
287  Relids required_outer);
288 
289 #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:3372
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2445
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:3008
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:308
Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:1996
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:2666
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:243
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1388
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:629
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:2149
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:3174
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:2731
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: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:3070
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:1000
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:446
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, WindowClause *winclause, List *winpathkeys)
Definition: pathnode.c:2944
ScanDirection
Definition: sdir.h:22
RelOptInfo * build_empty_join_rel(PlannerInfo *root)
Definition: relnode.c:885
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition: pathnode.c:3115
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:2028
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:365
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:2061
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3274
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1926
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:1126
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2278
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2512
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:919
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:2614
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:2885
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2556
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:970
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:2369
CmdType
Definition: nodes.h:649
Definition: relation.h:948
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:2214
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234
Path * create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)