PostgreSQL Source Code  git master
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
17 #include "nodes/relation.h"
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);
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);
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);
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);
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);
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);
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);
251 extern Path *reparameterize_path(PlannerInfo *root, Path *path,
252  Relids required_outer,
253  double loop_count);
255  RelOptInfo *child_rel);
257 /*
258  * prototypes for relnode.c
259  */
260 extern void setup_simple_rel_arrays(PlannerInfo *root);
261 extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
262  RelOptInfo *parent);
263 extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
264 extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
266  Relids joinrelids,
267  RelOptInfo *outer_rel,
268  RelOptInfo *inner_rel,
269  SpecialJoinInfo *sjinfo,
270  List **restrictlist_ptr);
272  Relids joinrelids,
273  RelOptInfo *outer_rel,
274  RelOptInfo *inner_rel);
277  Relids relids);
279  RelOptInfo *rel);
282  RelOptInfo *baserel,
283  Relids required_outer);
285  RelOptInfo *joinrel,
286  Path *outer_path,
287  Path *inner_path,
288  SpecialJoinInfo *sjinfo,
289  Relids required_outer,
290  List **restrict_clauses);
292  Relids required_outer);
294  Relids required_outer);
296  RelOptInfo *outer_rel, RelOptInfo *inner_rel,
297  RelOptInfo *parent_joinrel, List *restrictlist,
298  SpecialJoinInfo *sjinfo, JoinType jointype);
300 #endif /* PATHNODE_H */
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition: pathnode.c:946
bool add_path_precheck(RelOptInfo *parent_rel, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer)
Definition: pathnode.c:655
void add_path(RelOptInfo *parent_rel, Path *new_path)
Definition: pathnode.c:420
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:3418
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition: pathnode.c:2473
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:3054
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition: relnode.c:342
Definition: nodes.h:511
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1914
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:2695
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition: relnode.c:277
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Definition: pathnode.c:1401
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition: relnode.c:1544
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:1265
Definition: nodes.h:789
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:2164
Definition: nodes.h:675
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:3220
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:2761
int compare_fractional_path_costs(Path *path1, Path *path2, double fraction)
Definition: pathnode.c:115
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:1974
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:884
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition: pathnode.c:3116
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
Definition: pathnode.c:1440
int compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
Definition: pathnode.c:69
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1889
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1837
AppendPath * create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer, int parallel_workers, List *partitioned_rels)
Definition: pathnode.c:1211
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1811
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:242
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition: pathnode.c:1108
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:2990
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:3161
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
Definition: pathnode.c:3497
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:971
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition: pathnode.c:2043
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition: pathnode.c:1653
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:1016
unsigned int Index
Definition: c.h:413
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:2076
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, int64 offset_est, int64 count_est)
Definition: pathnode.c:3320
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1940
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition: pathnode.c:2010
Definition: nodes.h:759
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
Definition: pathnode.c:1075
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:2293
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition: pathnode.c:2540
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition: pathnode.c:1744
Definition: nodes.h:737
ResultPath * create_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *resconstantqual)
Definition: pathnode.c:1357
Definition: nodes.h:781
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, Relids required_outer)
Definition: pathnode.c:1783
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition: pathnode.c:1180
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:760
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:2643
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition: pathnode.c:2918
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *groupClause, List *qual, double numGroups)
Definition: pathnode.c:2584
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition: pathnode.c:1863
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:1144
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition: pathnode.c:2384
Definition: nodes.h:651
double Cost
Definition: nodes.h:642
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:2229
Datum subpath(PG_FUNCTION_ARGS)
Definition: ltree_op.c:234
Path * create_tablexprscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)