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 * Everything in subpaths or partial_subpaths will become part of the
22 * Append node's subpaths list. Partial and non-partial subpaths can be
23 * mixed in the same Append node only if it is parallel-aware.
24 *
25 * See the comments for AppendPath for the meaning and purpose of the
26 * child_append_relid_sets field.
27 */
34
35/* Hook for plugins to get control during joinrel setup */
37 RelOptInfo *joinrel,
40 SpecialJoinInfo *sjinfo,
41 List *restrictlist);
43
44/*
45 * prototypes for pathnode.c
46 */
50 double fraction);
53extern bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes,
54 Cost startup_cost, Cost total_cost,
55 List *pathkeys, Relids required_outer);
58 int disabled_nodes,
59 Cost total_cost, List *pathkeys);
60
62 Relids required_outer, int parallel_workers);
67 List *indexclauses,
68 List *indexorderbys,
69 List *indexorderbycols,
70 List *pathkeys,
71 ScanDirection indexscandir,
72 bool indexonly,
74 double loop_count,
75 bool partial_path);
77 RelOptInfo *rel,
78 Path *bitmapqual,
80 double loop_count,
81 int parallel_degree);
83 RelOptInfo *rel,
84 List *bitmapquals);
86 RelOptInfo *rel,
87 List *bitmapquals);
89 List *tidquals, Relids required_outer);
91 RelOptInfo *rel,
92 List *tidrangequals,
94 int parallel_workers);
95
98 List *pathkeys, Relids required_outer,
99 int parallel_workers, bool parallel_aware,
100 double rows);
102 RelOptInfo *rel,
103 List *subpaths,
104 List *child_append_relid_sets,
105 List *pathkeys,
108 RelOptInfo *rel,
109 PathTarget *target,
112 bool enabled);
114 RelOptInfo *rel,
115 Path *subpath,
116 List *param_exprs,
117 List *hash_operators,
118 bool singlerow,
119 bool binary_mode,
120 Cardinality est_calls);
122 RelOptInfo *rel, Path *subpath, PathTarget *target,
123 Relids required_outer, double *rows);
125 RelOptInfo *rel,
126 Path *subpath,
127 PathTarget *target,
128 List *pathkeys,
130 double *rows);
132 RelOptInfo *rel,
133 Path *subpath,
135 List *pathkeys,
138 List *pathkeys, Relids required_outer);
144 List *pathkeys, Relids required_outer);
152 PathTarget *target,
153 double rows, int disabled_nodes,
154 Cost startup_cost, Cost total_cost,
155 List *pathkeys,
157 Path *fdw_outerpath,
158 List *fdw_restrictinfo,
159 List *fdw_private);
161 PathTarget *target,
162 double rows, int disabled_nodes,
163 Cost startup_cost, Cost total_cost,
164 List *pathkeys,
166 Path *fdw_outerpath,
167 List *fdw_restrictinfo,
168 List *fdw_private);
170 PathTarget *target,
171 double rows, int disabled_nodes,
172 Cost startup_cost, Cost total_cost,
173 List *pathkeys,
174 Path *fdw_outerpath,
175 List *fdw_restrictinfo,
176 List *fdw_private);
177
183
185 RelOptInfo *joinrel,
186 JoinType jointype,
187 JoinCostWorkspace *workspace,
188 JoinPathExtraData *extra,
192 List *pathkeys,
194
196 RelOptInfo *joinrel,
197 JoinType jointype,
198 JoinCostWorkspace *workspace,
199 JoinPathExtraData *extra,
203 List *pathkeys,
205 List *mergeclauses,
206 List *outersortkeys,
207 List *innersortkeys,
208 int outer_presorted_keys);
209
211 RelOptInfo *joinrel,
212 JoinType jointype,
213 JoinCostWorkspace *workspace,
214 JoinPathExtraData *extra,
217 bool parallel_hash,
220 List *hashclauses);
221
223 RelOptInfo *rel,
224 Path *subpath,
225 PathTarget *target);
227 RelOptInfo *rel,
228 Path *path,
229 PathTarget *target);
231 RelOptInfo *rel,
232 Path *subpath,
233 PathTarget *target);
235 RelOptInfo *rel,
236 Path *subpath,
237 List *pathkeys,
238 double limit_tuples);
240 RelOptInfo *rel,
241 Path *subpath,
242 List *pathkeys,
243 int presorted_keys,
244 double limit_tuples);
246 RelOptInfo *rel,
247 Path *subpath,
248 List *groupClause,
249 List *qual,
250 double numGroups);
252 RelOptInfo *rel,
253 Path *subpath,
254 int numCols,
255 double numGroups);
257 RelOptInfo *rel,
258 Path *subpath,
259 PathTarget *target,
260 AggStrategy aggstrategy,
261 AggSplit aggsplit,
262 List *groupClause,
263 List *qual,
265 double numGroups);
267 RelOptInfo *rel,
268 Path *subpath,
270 AggStrategy aggstrategy,
271 List *rollups,
274 RelOptInfo *rel,
275 PathTarget *target,
276 List *mmaggregates,
277 List *quals);
279 RelOptInfo *rel,
280 Path *subpath,
281 PathTarget *target,
282 List *windowFuncs,
283 List *runCondition,
284 WindowClause *winclause,
285 List *qual,
286 bool topwindow);
288 RelOptInfo *rel,
289 Path *leftpath,
290 Path *rightpath,
291 SetOpCmd cmd,
292 SetOpStrategy strategy,
293 List *groupList,
294 double numGroups,
295 double outputRows);
297 RelOptInfo *rel,
298 Path *leftpath,
299 Path *rightpath,
300 PathTarget *target,
301 List *distinctList,
302 int wtParam,
303 double numGroups);
305 Path *subpath, List *rowMarks, int epqParam);
307 RelOptInfo *rel,
308 Path *subpath,
309 CmdType operation, bool canSetTag,
310 Index nominalRelation, Index rootRelation,
311 List *resultRelations,
312 List *updateColnosLists,
313 List *withCheckOptionLists, List *returningLists,
314 List *rowMarks, OnConflictExpr *onconflict,
315 List *mergeActionLists, List *mergeJoinConditions,
316 int epqParam);
318 Path *subpath,
319 Node *limitOffset, Node *limitCount,
320 LimitOption limitOption,
321 int64 offset_est, int64 count_est);
322extern void adjust_limit_rows_costs(double *rows,
323 Cost *startup_cost, Cost *total_cost,
324 int64 offset_est, int64 count_est);
325
328 double loop_count);
333
334/*
335 * prototypes for relnode.c
336 */
339extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
340 RelOptInfo *parent);
343extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
351 SpecialJoinInfo *sjinfo,
359 Relids relids);
365 RelOptInfo *joinrel,
368 SpecialJoinInfo *sjinfo,
378 RelOptInfo *parent_joinrel, List *restrictlist,
379 SpecialJoinInfo *sjinfo,
380 int nappinfos, AppendRelInfo **appinfos);
381
384#endif /* PATHNODE_H */
#define PGDLLIMPORT
Definition c.h:1356
int64_t int64
Definition c.h:555
unsigned int Index
Definition c.h:640
FILE * input
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:441
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:2257
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:2183
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition pathnode.c:1135
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:1892
bool path_is_reparameterizable_by_child(Path *path, RelOptInfo *child_rel)
Definition pathnode.c:4335
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:1699
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:1944
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath, bool enabled)
Definition pathnode.c:1665
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition pathnode.c:3255
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:2048
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:3419
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:3645
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition pathnode.c:2230
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:1053
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:2738
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:2540
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:1268
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:3346
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
Definition pathnode.c:4039
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition pathnode.c:3583
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition pathnode.c:2649
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition pathnode.c:987
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition pathnode.c:1766
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:2474
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:794
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:3745
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:1996
void(* joinrel_setup_hook_type)(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist)
Definition pathnode.h:36
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, bool trivial_pathtarget, List *pathkeys, Relids required_outer)
Definition pathnode.c:1862
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:2808
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:1187
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *having_qual, AggStrategy aggstrategy, List *rollups, const AggClauseCosts *agg_costs)
Definition pathnode.c:3092
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:1102
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:1918
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition pathnode.c:2857
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *groupClause, List *qual, double numGroups)
Definition pathnode.c:2901
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:2081
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *child_append_relid_sets, List *pathkeys, Relids required_outer)
Definition pathnode.c:1477
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition pathnode.c:1239
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition pathnode.c:1818
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1012
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:2129
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:2022
AppendPath * create_append_path(PlannerInfo *root, RelOptInfo *rel, AppendPathInput input, List *pathkeys, Relids required_outer, int parallel_workers, bool parallel_aware, double rows)
Definition pathnode.c:1305
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:3801
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition pathnode.c:1970
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition pathnode.c:2958
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:3010
bool add_partial_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost total_cost, List *pathkeys)
Definition pathnode.c:925
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:2406
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition pathnode.c:3538
GroupResultPath * create_group_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *havingqual)
Definition pathnode.c:1617
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
Definition pathnode.c:3869
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:2309
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
List * subpaths
Definition pathnode.h:30
List * child_append_relid_sets
Definition pathnode.h:32
List * partial_subpaths
Definition pathnode.h:31
Definition pg_list.h:54
Definition nodes.h:135
Definition type.h:96