PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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/pathnodes.h"
19
20
21/* Hook for plugins to get control during joinrel setup */
23 RelOptInfo *joinrel,
26 SpecialJoinInfo *sjinfo,
27 List *restrictlist);
29
30/*
31 * prototypes for pathnode.c
32 */
36 double fraction);
39extern bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes,
40 Cost startup_cost, Cost total_cost,
41 List *pathkeys, Relids required_outer);
44 int disabled_nodes,
45 Cost total_cost, List *pathkeys);
46
48 Relids required_outer, int parallel_workers);
53 List *indexclauses,
54 List *indexorderbys,
55 List *indexorderbycols,
56 List *pathkeys,
57 ScanDirection indexscandir,
58 bool indexonly,
60 double loop_count,
61 bool partial_path);
63 RelOptInfo *rel,
64 Path *bitmapqual,
66 double loop_count,
67 int parallel_degree);
69 RelOptInfo *rel,
70 List *bitmapquals);
72 RelOptInfo *rel,
73 List *bitmapquals);
75 List *tidquals, Relids required_outer);
77 RelOptInfo *rel,
78 List *tidrangequals,
80 int parallel_workers);
82 List *subpaths, List *partial_subpaths,
83 List *pathkeys, Relids required_outer,
84 int parallel_workers, bool parallel_aware,
85 double rows);
87 RelOptInfo *rel,
88 List *subpaths,
89 List *pathkeys,
92 RelOptInfo *rel,
93 PathTarget *target,
96 bool enabled);
98 RelOptInfo *rel,
100 List *param_exprs,
101 List *hash_operators,
102 bool singlerow,
103 bool binary_mode,
104 Cardinality est_calls);
106 RelOptInfo *rel, Path *subpath, PathTarget *target,
107 Relids required_outer, double *rows);
109 RelOptInfo *rel,
110 Path *subpath,
111 PathTarget *target,
112 List *pathkeys,
114 double *rows);
116 RelOptInfo *rel,
117 Path *subpath,
119 List *pathkeys,
122 List *pathkeys, Relids required_outer);
128 List *pathkeys, Relids required_outer);
136 PathTarget *target,
137 double rows, int disabled_nodes,
138 Cost startup_cost, Cost total_cost,
139 List *pathkeys,
141 Path *fdw_outerpath,
142 List *fdw_restrictinfo,
143 List *fdw_private);
145 PathTarget *target,
146 double rows, int disabled_nodes,
147 Cost startup_cost, Cost total_cost,
148 List *pathkeys,
150 Path *fdw_outerpath,
151 List *fdw_restrictinfo,
152 List *fdw_private);
154 PathTarget *target,
155 double rows, int disabled_nodes,
156 Cost startup_cost, Cost total_cost,
157 List *pathkeys,
158 Path *fdw_outerpath,
159 List *fdw_restrictinfo,
160 List *fdw_private);
161
167
169 RelOptInfo *joinrel,
170 JoinType jointype,
171 JoinCostWorkspace *workspace,
172 JoinPathExtraData *extra,
176 List *pathkeys,
178
180 RelOptInfo *joinrel,
181 JoinType jointype,
182 JoinCostWorkspace *workspace,
183 JoinPathExtraData *extra,
187 List *pathkeys,
189 List *mergeclauses,
190 List *outersortkeys,
191 List *innersortkeys,
192 int outer_presorted_keys);
193
195 RelOptInfo *joinrel,
196 JoinType jointype,
197 JoinCostWorkspace *workspace,
198 JoinPathExtraData *extra,
201 bool parallel_hash,
204 List *hashclauses);
205
207 RelOptInfo *rel,
208 Path *subpath,
209 PathTarget *target);
211 RelOptInfo *rel,
212 Path *path,
213 PathTarget *target);
215 RelOptInfo *rel,
216 Path *subpath,
217 PathTarget *target);
219 RelOptInfo *rel,
220 Path *subpath,
221 List *pathkeys,
222 double limit_tuples);
224 RelOptInfo *rel,
225 Path *subpath,
226 List *pathkeys,
227 int presorted_keys,
228 double limit_tuples);
230 RelOptInfo *rel,
231 Path *subpath,
232 List *groupClause,
233 List *qual,
234 double numGroups);
236 RelOptInfo *rel,
237 Path *subpath,
238 int numCols,
239 double numGroups);
241 RelOptInfo *rel,
242 Path *subpath,
243 PathTarget *target,
244 AggStrategy aggstrategy,
245 AggSplit aggsplit,
246 List *groupClause,
247 List *qual,
249 double numGroups);
251 RelOptInfo *rel,
252 Path *subpath,
254 AggStrategy aggstrategy,
255 List *rollups,
258 RelOptInfo *rel,
259 PathTarget *target,
260 List *mmaggregates,
261 List *quals);
263 RelOptInfo *rel,
264 Path *subpath,
265 PathTarget *target,
266 List *windowFuncs,
267 List *runCondition,
268 WindowClause *winclause,
269 List *qual,
270 bool topwindow);
272 RelOptInfo *rel,
273 Path *leftpath,
274 Path *rightpath,
275 SetOpCmd cmd,
276 SetOpStrategy strategy,
277 List *groupList,
278 double numGroups,
279 double outputRows);
281 RelOptInfo *rel,
282 Path *leftpath,
283 Path *rightpath,
284 PathTarget *target,
285 List *distinctList,
286 int wtParam,
287 double numGroups);
289 Path *subpath, List *rowMarks, int epqParam);
291 RelOptInfo *rel,
292 Path *subpath,
293 CmdType operation, bool canSetTag,
294 Index nominalRelation, Index rootRelation,
295 List *resultRelations,
296 List *updateColnosLists,
297 List *withCheckOptionLists, List *returningLists,
298 List *rowMarks, OnConflictExpr *onconflict,
299 List *mergeActionLists, List *mergeJoinConditions,
300 int epqParam);
302 Path *subpath,
303 Node *limitOffset, Node *limitCount,
304 LimitOption limitOption,
305 int64 offset_est, int64 count_est);
306extern void adjust_limit_rows_costs(double *rows,
307 Cost *startup_cost, Cost *total_cost,
308 int64 offset_est, int64 count_est);
309
312 double loop_count);
317
318/*
319 * prototypes for relnode.c
320 */
323extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
324 RelOptInfo *parent);
327extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
335 SpecialJoinInfo *sjinfo,
343 Relids relids);
349 RelOptInfo *joinrel,
352 SpecialJoinInfo *sjinfo,
362 RelOptInfo *parent_joinrel, List *restrictlist,
363 SpecialJoinInfo *sjinfo,
364 int nappinfos, AppendRelInfo **appinfos);
365
368#endif /* PATHNODE_H */
#define PGDLLIMPORT
Definition c.h:1334
int64_t int64
Definition c.h:543
unsigned int Index
Definition c.h:628
Datum subpath(PG_FUNCTION_ARGS)
Definition ltree_op.c:311
SetOpCmd
Definition nodes.h:407
SetOpStrategy
Definition nodes.h:415
double Cost
Definition nodes.h:261
double Cardinality
Definition nodes.h:262
CmdType
Definition nodes.h:273
AggStrategy
Definition nodes.h:363
AggSplit
Definition nodes.h:385
LimitOption
Definition nodes.h:440
JoinType
Definition nodes.h:298
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
Definition relnode.c:533
void setup_simple_rel_arrays(PlannerInfo *root)
Definition relnode.c:111
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition relnode.c:2004
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition pathnode.c:2248
ForeignPath * create_foreign_upper_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, double rows, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Path *fdw_outerpath, List *fdw_restrictinfo, List *fdw_private)
Definition pathnode.c:2174
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition pathnode.c:1129
RelOptInfo * build_grouped_rel(PlannerInfo *root, RelOptInfo *rel)
Definition relnode.c:488
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition pathnode.c:1883
bool path_is_reparameterizable_by_child(Path *path, RelOptInfo *child_rel)
Definition pathnode.c:4325
MemoizePath * create_memoize_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *param_exprs, List *hash_operators, bool singlerow, bool binary_mode, Cardinality est_calls)
Definition pathnode.c:1690
RelOptInfo * build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel, RelOptInfo *parent_joinrel, List *restrictlist, SpecialJoinInfo *sjinfo, int nappinfos, AppendRelInfo **appinfos)
Definition relnode.c:1015
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1935
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath, bool enabled)
Definition pathnode.c:1656
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition pathnode.c:3246
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:2039
SetOpPath * create_setop_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, SetOpCmd cmd, SetOpStrategy strategy, List *groupList, double numGroups, double outputRows)
Definition pathnode.c:3410
ModifyTablePath * create_modifytable_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, CmdType operation, bool canSetTag, Index nominalRelation, Index rootRelation, List *resultRelations, List *updateColnosLists, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, List *mergeActionLists, List *mergeJoinConditions, int epqParam)
Definition pathnode.c:3636
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition pathnode.c:2221
RelOptInfo * find_base_rel_noerr(PlannerInfo *root, int relid)
Definition relnode.c:555
IndexPath * create_index_path(PlannerInfo *root, IndexOptInfo *index, List *indexclauses, List *indexorderbys, List *indexorderbycols, List *pathkeys, ScanDirection indexscandir, bool indexonly, Relids required_outer, double loop_count, bool partial_path)
Definition pathnode.c:1047
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition relnode.c:1170
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition pathnode.c:2729
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition relnode.c:646
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition pathnode.c:2531
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:1807
TidRangePath * create_tidrangescan_path(PlannerInfo *root, RelOptInfo *rel, List *tidrangequals, Relids required_outer, int parallel_workers)
Definition pathnode.c:1262
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, List *runCondition, WindowClause *winclause, List *qual, bool topwindow)
Definition pathnode.c:3337
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
Definition pathnode.c:4029
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition pathnode.c:3574
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition pathnode.c:2640
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition pathnode.c:981
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition pathnode.c:1757
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:2465
void set_cheapest(RelOptInfo *parent_rel)
Definition pathnode.c:268
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
Definition relnode.c:1657
void expand_planner_arrays(PlannerInfo *root, int add_size)
Definition relnode.c:180
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition relnode.c:1693
RelOptInfo * build_simple_grouped_rel(PlannerInfo *root, RelOptInfo *rel)
Definition relnode.c:437
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
Definition pathnode.c:793
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, LimitOption limitOption, int64 offset_est, int64 count_est)
Definition pathnode.c:3736
AppendPath * create_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *partial_subpaths, List *pathkeys, Relids required_outer, int parallel_workers, bool parallel_aware, double rows)
Definition pathnode.c:1299
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
Definition relnode.c:1606
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1987
void(* joinrel_setup_hook_type)(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist)
Definition pathnode.h:22
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, bool trivial_pathtarget, List *pathkeys, Relids required_outer)
Definition pathnode.c:1853
int compare_fractional_path_costs(Path *path1, Path *path2, double fraction)
Definition pathnode.c:123
PGDLLIMPORT joinrel_setup_hook_type joinrel_setup_hook
Definition relnode.c:51
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *pushed_down_joins, List **restrictlist_ptr)
Definition relnode.c:784
IncrementalSortPath * create_incremental_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, int presorted_keys, double limit_tuples)
Definition pathnode.c:2799
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
Definition relnode.c:209
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition pathnode.c:1181
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *having_qual, AggStrategy aggstrategy, List *rollups, const AggClauseCosts *agg_costs)
Definition pathnode.c:3083
RelAggInfo * create_rel_agg_info(PlannerInfo *root, RelOptInfo *rel, bool calculate_grouped_rows)
Definition relnode.c:2680
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
Definition pathnode.c:1096
ParamPathInfo * find_param_path_info(RelOptInfo *rel, Relids required_outer)
Definition relnode.c:2037
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1909
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition pathnode.c:2848
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *groupClause, List *qual, double numGroups)
Definition pathnode.c:2892
ForeignPath * create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, double rows, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer, Path *fdw_outerpath, List *fdw_restrictinfo, List *fdw_private)
Definition pathnode.c:2072
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition pathnode.c:1233
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition pathnode.c:1809
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1006
ForeignPath * create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, double rows, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer, Path *fdw_outerpath, List *fdw_restrictinfo, List *fdw_private)
Definition pathnode.c:2120
void add_path(RelOptInfo *parent_rel, Path *new_path)
Definition pathnode.c:459
int compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
Definition pathnode.c:68
bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer)
Definition pathnode.c:686
Path * create_resultscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:2013
Bitmapset * get_param_path_clause_serials(Path *path)
Definition relnode.c:2058
void adjust_limit_rows_costs(double *rows, Cost *startup_cost, Cost *total_cost, int64 offset_est, int64 count_est)
Definition pathnode.c:3792
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition pathnode.c:1961
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition pathnode.c:2949
RelOptInfo * find_base_rel_ignore_join(PlannerInfo *root, int relid)
Definition relnode.c:573
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:3001
bool add_partial_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost total_cost, List *pathkeys)
Definition pathnode.c:919
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, int outer_presorted_keys)
Definition pathnode.c:2397
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition pathnode.c:3529
GroupResultPath * create_group_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *havingqual)
Definition pathnode.c:1608
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer)
Definition pathnode.c:1470
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
Definition pathnode.c:3860
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:2300
CostSelector
Definition pathnodes.h:110
UpperRelationKind
Definition pathnodes.h:143
static int fb(int x)
tree ctl root
Definition radixtree.h:1857
ScanDirection
Definition sdir.h:25
Size add_size(Size s1, Size s2)
Definition shmem.c:482
Definition pg_list.h:54
Definition nodes.h:135
Definition type.h:96