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/* Hook for plugins to get control in build_simple_rel() */
22 RelOptInfo *rel,
25
26/*
27 * Everything in subpaths or partial_subpaths will become part of the
28 * Append node's subpaths list. Partial and non-partial subpaths can be
29 * mixed in the same Append node only if it is parallel-aware.
30 *
31 * See the comments for AppendPath for the meaning and purpose of the
32 * child_append_relid_sets field.
33 */
40
41/* Hook for plugins to get control during joinrel setup */
43 RelOptInfo *joinrel,
46 SpecialJoinInfo *sjinfo,
47 List *restrictlist);
49
50/*
51 * prototypes for pathnode.c
52 */
56 double fraction);
59extern bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes,
60 Cost startup_cost, Cost total_cost,
61 List *pathkeys, Relids required_outer);
64 int disabled_nodes, Cost startup_cost,
65 Cost total_cost, List *pathkeys);
66
68 Relids required_outer, int parallel_workers);
73 List *indexclauses,
74 List *indexorderbys,
75 List *indexorderbycols,
76 List *pathkeys,
77 ScanDirection indexscandir,
78 bool indexonly,
80 double loop_count,
81 bool partial_path);
83 RelOptInfo *rel,
84 Path *bitmapqual,
86 double loop_count,
87 int parallel_degree);
89 RelOptInfo *rel,
90 List *bitmapquals);
92 RelOptInfo *rel,
93 List *bitmapquals);
95 List *tidquals, Relids required_outer);
97 RelOptInfo *rel,
98 List *tidrangequals,
100 int parallel_workers);
101
104 List *pathkeys, Relids required_outer,
105 int parallel_workers, bool parallel_aware,
106 double rows);
108 RelOptInfo *rel,
109 List *subpaths,
110 List *child_append_relid_sets,
111 List *pathkeys,
114 RelOptInfo *rel,
115 PathTarget *target,
118 bool enabled);
120 RelOptInfo *rel,
121 Path *subpath,
122 List *param_exprs,
123 List *hash_operators,
124 bool singlerow,
125 bool binary_mode,
126 Cardinality est_calls);
128 RelOptInfo *rel, Path *subpath, PathTarget *target,
129 Relids required_outer, double *rows);
131 RelOptInfo *rel,
132 Path *subpath,
133 PathTarget *target,
134 List *pathkeys,
136 double *rows);
138 RelOptInfo *rel,
139 Path *subpath,
141 List *pathkeys,
144 List *pathkeys, Relids required_outer);
150 List *pathkeys, Relids required_outer);
158 PathTarget *target,
159 double rows, int disabled_nodes,
160 Cost startup_cost, Cost total_cost,
161 List *pathkeys,
163 Path *fdw_outerpath,
164 List *fdw_restrictinfo,
165 List *fdw_private);
167 PathTarget *target,
168 double rows, int disabled_nodes,
169 Cost startup_cost, Cost total_cost,
170 List *pathkeys,
172 Path *fdw_outerpath,
173 List *fdw_restrictinfo,
174 List *fdw_private);
176 PathTarget *target,
177 double rows, int disabled_nodes,
178 Cost startup_cost, Cost total_cost,
179 List *pathkeys,
180 Path *fdw_outerpath,
181 List *fdw_restrictinfo,
182 List *fdw_private);
183
189
191 RelOptInfo *joinrel,
192 JoinType jointype,
193 JoinCostWorkspace *workspace,
194 JoinPathExtraData *extra,
198 List *pathkeys,
200
202 RelOptInfo *joinrel,
203 JoinType jointype,
204 JoinCostWorkspace *workspace,
205 JoinPathExtraData *extra,
209 List *pathkeys,
211 List *mergeclauses,
212 List *outersortkeys,
213 List *innersortkeys,
214 int outer_presorted_keys);
215
217 RelOptInfo *joinrel,
218 JoinType jointype,
219 JoinCostWorkspace *workspace,
220 JoinPathExtraData *extra,
223 bool parallel_hash,
226 List *hashclauses);
227
229 RelOptInfo *rel,
230 Path *subpath,
231 PathTarget *target);
233 RelOptInfo *rel,
234 Path *path,
235 PathTarget *target);
237 RelOptInfo *rel,
238 Path *subpath,
239 PathTarget *target);
241 RelOptInfo *rel,
242 Path *subpath,
243 List *pathkeys,
244 double limit_tuples);
246 RelOptInfo *rel,
247 Path *subpath,
248 List *pathkeys,
249 int presorted_keys,
250 double limit_tuples);
252 RelOptInfo *rel,
253 Path *subpath,
254 List *groupClause,
255 List *qual,
256 double numGroups);
258 RelOptInfo *rel,
259 Path *subpath,
260 int numCols,
261 double numGroups);
263 RelOptInfo *rel,
264 Path *subpath,
265 PathTarget *target,
266 AggStrategy aggstrategy,
267 AggSplit aggsplit,
268 List *groupClause,
269 List *qual,
271 double numGroups);
273 RelOptInfo *rel,
274 Path *subpath,
276 AggStrategy aggstrategy,
277 List *rollups,
280 RelOptInfo *rel,
281 PathTarget *target,
282 List *mmaggregates,
283 List *quals);
285 RelOptInfo *rel,
286 Path *subpath,
287 PathTarget *target,
288 List *windowFuncs,
289 List *runCondition,
290 WindowClause *winclause,
291 List *qual,
292 bool topwindow);
294 RelOptInfo *rel,
295 Path *leftpath,
296 Path *rightpath,
297 SetOpCmd cmd,
298 SetOpStrategy strategy,
299 List *groupList,
300 double numGroups,
301 double outputRows);
303 RelOptInfo *rel,
304 Path *leftpath,
305 Path *rightpath,
306 PathTarget *target,
307 List *distinctList,
308 int wtParam,
309 double numGroups);
311 Path *subpath, List *rowMarks, int epqParam);
313 RelOptInfo *rel,
314 Path *subpath,
315 CmdType operation, bool canSetTag,
316 Index nominalRelation, Index rootRelation,
317 List *resultRelations,
318 List *updateColnosLists,
319 List *withCheckOptionLists, List *returningLists,
320 List *rowMarks, OnConflictExpr *onconflict,
321 List *mergeActionLists, List *mergeJoinConditions,
322 int epqParam);
324 Path *subpath,
325 Node *limitOffset, Node *limitCount,
326 LimitOption limitOption,
327 int64 offset_est, int64 count_est);
328extern void adjust_limit_rows_costs(double *rows,
329 Cost *startup_cost, Cost *total_cost,
330 int64 offset_est, int64 count_est);
331
334 double loop_count);
339
340/*
341 * prototypes for relnode.c
342 */
345extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
346 RelOptInfo *parent);
349extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
357 SpecialJoinInfo *sjinfo,
365 Relids relids);
371 RelOptInfo *joinrel,
374 SpecialJoinInfo *sjinfo,
384 RelOptInfo *parent_joinrel, List *restrictlist,
385 SpecialJoinInfo *sjinfo,
386 int nappinfos, AppendRelInfo **appinfos);
387
390#endif /* PATHNODE_H */
#define PGDLLIMPORT
Definition c.h:1423
int64_t int64
Definition c.h:615
unsigned int Index
Definition c.h:700
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:544
void setup_simple_rel_arrays(PlannerInfo *root)
Definition relnode.c:114
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
Definition relnode.c:2015
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
Definition pathnode.c:2304
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:2230
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition pathnode.c:1182
RelOptInfo * build_grouped_rel(PlannerInfo *root, RelOptInfo *rel)
Definition relnode.c:499
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition pathnode.c:1939
bool path_is_reparameterizable_by_child(Path *path, RelOptInfo *child_rel)
Definition pathnode.c:4382
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:1746
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:1026
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1991
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath, bool enabled)
Definition pathnode.c:1712
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Definition pathnode.c:3302
bool add_partial_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys)
Definition pathnode.c:912
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:2095
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:3466
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:3692
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Definition pathnode.c:2277
RelOptInfo * find_base_rel_noerr(PlannerInfo *root, int relid)
Definition relnode.c:566
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:1092
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
Definition relnode.c:1181
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition pathnode.c:2785
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
Definition relnode.c:657
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
Definition pathnode.c:2587
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:1818
PGDLLIMPORT build_simple_rel_hook_type build_simple_rel_hook
Definition relnode.c:51
TidRangePath * create_tidrangescan_path(PlannerInfo *root, RelOptInfo *rel, List *tidrangequals, Relids required_outer, int parallel_workers)
Definition pathnode.c:1315
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:3393
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
Definition pathnode.c:4086
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Definition pathnode.c:3630
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
Definition pathnode.c:2696
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
Definition pathnode.c:1026
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
Definition pathnode.c:1813
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:2521
void set_cheapest(RelOptInfo *parent_rel)
Definition pathnode.c:268
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
Definition relnode.c:1668
void expand_planner_arrays(PlannerInfo *root, int add_size)
Definition relnode.c:183
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
Definition relnode.c:1704
RelOptInfo * build_simple_grouped_rel(PlannerInfo *root, RelOptInfo *rel)
Definition relnode.c:448
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:3792
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
Definition relnode.c:1617
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:2043
void(* joinrel_setup_hook_type)(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist)
Definition pathnode.h:42
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, bool trivial_pathtarget, List *pathkeys, Relids required_outer)
Definition pathnode.c:1909
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:54
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:795
IncrementalSortPath * create_incremental_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, int presorted_keys, double limit_tuples)
Definition pathnode.c:2855
void(* build_simple_rel_hook_type)(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
Definition pathnode.h:21
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
Definition relnode.c:212
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
Definition pathnode.c:1234
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *having_qual, AggStrategy aggstrategy, List *rollups, const AggClauseCosts *agg_costs)
Definition pathnode.c:3139
RelAggInfo * create_rel_agg_info(PlannerInfo *root, RelOptInfo *rel, bool calculate_grouped_rows)
Definition relnode.c:2691
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
Definition pathnode.c:1149
ParamPathInfo * find_param_path_info(RelOptInfo *rel, Relids required_outer)
Definition relnode.c:2048
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1965
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
Definition pathnode.c:2904
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *groupClause, List *qual, double numGroups)
Definition pathnode.c:2948
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:2128
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *child_append_relid_sets, List *pathkeys, Relids required_outer)
Definition pathnode.c:1524
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
Definition pathnode.c:1286
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Definition pathnode.c:1865
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Definition pathnode.c:1051
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:2176
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:2069
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:1352
Bitmapset * get_param_path_clause_serials(Path *path)
Definition relnode.c:2069
void adjust_limit_rows_costs(double *rows, Cost *startup_cost, Cost *total_cost, int64 offset_est, int64 count_est)
Definition pathnode.c:3848
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
Definition pathnode.c:2017
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
Definition pathnode.c:3005
RelOptInfo * find_base_rel_ignore_join(PlannerInfo *root, int relid)
Definition relnode.c:584
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:3057
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:2453
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
Definition pathnode.c:3585
GroupResultPath * create_group_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *havingqual)
Definition pathnode.c:1664
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
Definition pathnode.c:3916
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:2356
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:485
List * subpaths
Definition pathnode.h:36
List * child_append_relid_sets
Definition pathnode.h:38
List * partial_subpaths
Definition pathnode.h:37
Definition pg_list.h:54
Definition nodes.h:135
Definition type.h:96