47 #define STD_FUZZ_FACTOR 1.01
139 if (fraction <= 0.0 || fraction >= 1.0)
184 #define CONSIDER_PATH_STARTUP_COST(p) \
185 ((p)->param_info == NULL ? (p)->parent->consider_startup : (p)->parent->consider_param_startup)
238 #undef CONSIDER_PATH_STARTUP_COST
271 Path *cheapest_startup_path;
272 Path *cheapest_total_path;
273 Path *best_param_path;
274 List *parameterized_paths;
280 elog(
ERROR,
"could not devise a query plan for the given query");
282 cheapest_startup_path = cheapest_total_path = best_param_path = NULL;
283 parameterized_paths =
NIL;
290 if (path->param_info)
293 parameterized_paths =
lappend(parameterized_paths, path);
299 if (cheapest_total_path)
307 if (best_param_path == NULL)
308 best_param_path = path;
318 best_param_path = path;
322 best_param_path = path;
341 if (cheapest_total_path == NULL)
343 cheapest_startup_path = cheapest_total_path = path;
359 cheapest_startup_path = path;
366 cheapest_total_path = path;
371 if (cheapest_total_path)
372 parameterized_paths =
lcons(cheapest_total_path, parameterized_paths);
378 if (cheapest_total_path == NULL)
379 cheapest_total_path = best_param_path;
380 Assert(cheapest_total_path != NULL);
463 bool accept_new =
true;
465 List *new_path_pathkeys;
475 new_path_pathkeys = new_path->param_info ?
NIL : new_path->
pathkeys;
485 bool remove_old =
false;
510 List *old_path_pathkeys;
512 old_path_pathkeys = old_path->param_info ?
NIL : old_path->
pathkeys;
563 else if (new_path->
rows < old_path->
rows)
565 else if (new_path->
rows > old_path->
rows)
692 List *new_path_pathkeys;
693 bool consider_startup;
697 new_path_pathkeys = required_outer ?
NIL : pathkeys;
715 if (disabled_nodes < old_path->disabled_nodes)
734 List *old_path_pathkeys;
736 old_path_pathkeys = old_path->param_info ?
NIL : old_path->
pathkeys;
797 bool accept_new =
true;
817 bool remove_old =
false;
984 Relids required_outer,
int parallel_workers)
989 pathnode->parent = rel;
1013 pathnode->parent = rel;
1052 List *indexorderbys,
1053 List *indexorderbycols,
1064 pathnode->
path.
pathtype = indexonly ? T_IndexOnlyScan : T_IndexScan;
1065 pathnode->
path.parent = rel;
1103 int parallel_degree)
1108 pathnode->
path.parent = rel;
1120 pathnode->
path.param_info,
1121 bitmapqual, loop_count);
1136 Relids required_outer = NULL;
1140 pathnode->
path.parent = rel;
1148 foreach(lc, bitmapquals)
1188 Relids required_outer = NULL;
1192 pathnode->
path.parent = rel;
1200 foreach(lc, bitmapquals)
1241 pathnode->
path.parent = rel;
1253 pathnode->
path.param_info);
1270 pathnode->
path.parent = rel;
1282 pathnode->
path.param_info);
1302 List *subpaths,
List *partial_subpaths,
1304 int parallel_workers,
bool parallel_aware,
1310 Assert(!parallel_aware || parallel_workers > 0);
1313 pathnode->
path.parent = rel;
1440 return bms_compare(path1->parent->relids, path2->parent->relids);
1462 return bms_compare(path1->parent->relids, path2->parent->relids);
1478 int input_disabled_nodes;
1479 Cost input_startup_cost;
1480 Cost input_total_cost;
1490 pathnode->
path.parent = rel;
1492 pathnode->
path.param_info = NULL;
1512 input_disabled_nodes = 0;
1513 input_startup_cost = 0;
1514 input_total_cost = 0;
1515 foreach(l, subpaths)
1529 input_disabled_nodes +=
subpath->disabled_nodes;
1530 input_startup_cost +=
subpath->startup_cost;
1531 input_total_cost +=
subpath->total_cost;
1571 input_disabled_nodes,
1572 input_startup_cost, input_total_cost,
1592 pathnode->
path.parent = rel;
1593 pathnode->
path.pathtarget = target;
1594 pathnode->
path.param_info = NULL;
1599 pathnode->
quals = havingqual;
1641 pathnode->
path.parent = rel;
1668 List *param_exprs,
List *hash_operators,
1669 bool singlerow,
bool binary_mode,
double calls)
1676 pathnode->
path.parent = rel;
1766 pathnode->
path.parent = rel;
1830 List *sub_tlist_colnos;
1835 if (sub_tlist_colnos &&
1893 int hashentrysize =
subpath->pathtarget->width + 64;
1964 Relids required_outer,
double *rows)
1967 int input_disabled_nodes = 0;
1968 Cost input_startup_cost = 0;
1969 Cost input_total_cost = 0;
1982 elog(
ERROR,
"gather merge input not sufficiently sorted");
1985 pathnode->
path.parent = rel;
1993 pathnode->
path.pathtarget = target ? target : rel->
reltarget;
1995 input_disabled_nodes +=
subpath->disabled_nodes;
1996 input_startup_cost +=
subpath->startup_cost;
1997 input_total_cost +=
subpath->total_cost;
2000 input_disabled_nodes, input_startup_cost,
2001 input_total_cost, rows);
2027 if (!var || !
IsA(var,
Var) ||
2028 var->
varno != relid)
2052 pathnode->
path.parent = rel;
2053 pathnode->
path.pathtarget = target;
2089 bool trivial_pathtarget,
2095 pathnode->
path.parent = rel;
2107 trivial_pathtarget);
2123 pathnode->
pathtype = T_FunctionScan;
2124 pathnode->parent = rel;
2149 pathnode->
pathtype = T_TableFuncScan;
2150 pathnode->parent = rel;
2176 pathnode->parent = rel;
2202 pathnode->parent = rel;
2227 pathnode->
pathtype = T_NamedTuplestoreScan;
2228 pathnode->parent = rel;
2254 pathnode->parent = rel;
2279 pathnode->
pathtype = T_WorkTableScan;
2280 pathnode->parent = rel;
2309 double rows,
int disabled_nodes,
2310 Cost startup_cost,
Cost total_cost,
2313 Path *fdw_outerpath,
2314 List *fdw_restrictinfo,
2323 pathnode->
path.parent = rel;
2324 pathnode->
path.pathtarget = target ? target : rel->
reltarget;
2357 double rows,
int disabled_nodes,
2358 Cost startup_cost,
Cost total_cost,
2361 Path *fdw_outerpath,
2362 List *fdw_restrictinfo,
2375 elog(
ERROR,
"parameterized foreign joins are not supported yet");
2378 pathnode->
path.parent = rel;
2379 pathnode->
path.pathtarget = target ? target : rel->
reltarget;
2380 pathnode->
path.param_info = NULL;
2411 double rows,
int disabled_nodes,
2412 Cost startup_cost,
Cost total_cost,
2414 Path *fdw_outerpath,
2415 List *fdw_restrictinfo,
2427 pathnode->
path.parent = rel;
2428 pathnode->
path.pathtarget = target ? target : rel->
reltarget;
2429 pathnode->
path.param_info = NULL;
2466 if (!inner_paramrels)
2469 required_outer =
bms_union(outer_paramrels, inner_paramrels);
2473 return required_outer;
2498 if (inner_path->parent->top_parent_relids)
2499 innerrelids = inner_path->parent->top_parent_relids;
2501 innerrelids = inner_path->parent->relids;
2503 if (outer_path->parent->top_parent_relids)
2504 outerrelids = outer_path->parent->top_parent_relids;
2506 outerrelids = outer_path->parent->relids;
2512 required_outer =
bms_union(outer_paramrels, inner_paramrels);
2514 return required_outer;
2542 List *restrict_clauses,
2554 if (outer_path->parent->top_parent_relids)
2555 outerrelids = outer_path->parent->top_parent_relids;
2557 outerrelids = outer_path->parent->relids;
2573 foreach(lc, restrict_clauses)
2578 jclauses =
lappend(jclauses, rinfo);
2580 restrict_clauses = jclauses;
2583 pathnode->
jpath.path.pathtype = T_NestLoop;
2584 pathnode->
jpath.path.parent = joinrel;
2586 pathnode->
jpath.path.param_info =
2594 pathnode->
jpath.path.parallel_aware =
false;
2599 pathnode->
jpath.path.pathkeys = pathkeys;
2638 List *restrict_clauses,
2642 List *outersortkeys,
2643 List *innersortkeys)
2647 pathnode->
jpath.path.pathtype = T_MergeJoin;
2648 pathnode->
jpath.path.parent = joinrel;
2650 pathnode->
jpath.path.param_info =
2658 pathnode->
jpath.path.parallel_aware =
false;
2663 pathnode->
jpath.path.pathkeys = pathkeys;
2705 List *restrict_clauses,
2711 pathnode->
jpath.path.pathtype = T_HashJoin;
2712 pathnode->
jpath.path.parent = joinrel;
2714 pathnode->
jpath.path.param_info =
2722 pathnode->
jpath.path.parallel_aware =
2740 pathnode->
jpath.path.pathkeys =
NIL;
2788 pathnode->
path.parent = rel;
2789 pathnode->
path.pathtarget = target;
2791 pathnode->
path.param_info = NULL;
2811 oldtarget =
subpath->pathtarget;
2891 oldcost = path->pathtarget->cost;
2892 path->pathtarget = target;
2972 pathnode->
path.parent = rel;
2973 pathnode->
path.pathtarget = target;
2975 pathnode->
path.param_info = NULL;
2991 foreach(lc, target->
exprs)
2997 if (tlist_rows < itemrows)
2998 tlist_rows = itemrows;
3037 double limit_tuples)
3043 pathnode->
path.parent = rel;
3047 pathnode->
path.param_info = NULL;
3057 root, pathkeys, presorted_keys,
3066 sort->nPresortedCols = presorted_keys;
3086 double limit_tuples)
3091 pathnode->
path.parent = rel;
3095 pathnode->
path.param_info = NULL;
3138 pathnode->
path.parent = rel;
3139 pathnode->
path.pathtarget = target;
3141 pathnode->
path.param_info = NULL;
3152 pathnode->
qual = qual;
3196 pathnode->
path.parent = rel;
3200 pathnode->
path.param_info = NULL;
3254 pathnode->
path.parent = rel;
3255 pathnode->
path.pathtarget = target;
3257 pathnode->
path.param_info = NULL;
3275 root->num_groupby_pathkeys);
3289 pathnode->
qual = qual;
3292 aggstrategy, aggcosts,
3334 bool is_first =
true;
3335 bool is_first_sort =
true;
3339 pathnode->
path.parent = rel;
3340 pathnode->
path.pathtarget = target;
3373 pathnode->
qual = having_qual;
3380 foreach(lc, rollups)
3411 is_first_sort =
false;
3434 is_first_sort =
false;
3494 int initplan_disabled_nodes = 0;
3499 pathnode->
path.parent = rel;
3500 pathnode->
path.pathtarget = target;
3502 pathnode->
path.param_info = NULL;
3511 pathnode->
quals = quals;
3515 foreach(lc, mmaggregates)
3593 pathnode->
path.parent = rel;
3594 pathnode->
path.pathtarget = target;
3596 pathnode->
path.param_info = NULL;
3606 pathnode->
qual = qual;
3662 pathnode->
path.parent = rel;
3666 pathnode->
path.param_info = NULL;
3676 pathnode->
cmd = cmd;
3723 pathnode->
path.parent = rel;
3724 pathnode->
path.pathtarget = target;
3726 pathnode->
path.param_info = NULL;
3762 pathnode->
path.parent = rel;
3766 pathnode->
path.param_info = NULL;
3822 CmdType operation,
bool canSetTag,
3824 bool partColsUpdated,
3825 List *resultRelations,
3826 List *updateColnosLists,
3827 List *withCheckOptionLists,
List *returningLists,
3829 List *mergeActionLists,
List *mergeJoinConditions,
3837 updateColnosLists ==
NIL));
3844 pathnode->
path.parent = rel;
3848 pathnode->
path.param_info = NULL;
3867 if (returningLists !=
NIL)
3877 pathnode->
path.pathtarget->width =
subpath->pathtarget->width;
3882 pathnode->
path.pathtarget->width = 0;
3924 Node *limitOffset,
Node *limitCount,
3931 pathnode->
path.parent = rel;
3935 pathnode->
path.param_info = NULL;
3956 offset_est, count_est);
3984 double input_rows = *rows;
3985 Cost input_startup_cost = *startup_cost;
3986 Cost input_total_cost = *total_cost;
3988 if (offset_est != 0)
3993 offset_rows = (double) offset_est;
3996 if (offset_rows > *rows)
3997 offset_rows = *rows;
4000 (input_total_cost - input_startup_cost)
4001 * offset_rows / input_rows;
4002 *rows -= offset_rows;
4012 count_rows = (double) count_est;
4015 if (count_rows > *rows)
4018 *total_cost = *startup_cost +
4019 (input_total_cost - input_startup_cost)
4020 * count_rows / input_rows;
4062 case T_IndexOnlyScan:
4074 memcpy(newpath, ipath,
sizeof(
IndexPath));
4075 newpath->
path.param_info =
4078 return (
Path *) newpath;
4080 case T_BitmapHeapScan:
4090 case T_SubqueryScan:
4094 bool trivial_pathtarget;
4103 trivial_pathtarget =
4138 if (i < apath->first_partial_path)
4139 childpaths =
lappend(childpaths, spath);
4141 partialpaths =
lappend(partialpaths, spath);
4220 #define ADJUST_CHILD_ATTRS(node) \
4221 ((node) = (void *) adjust_appendrel_attrs_multilevel(root, \
4224 child_rel->top_parent))
4226 #define REPARAMETERIZE_CHILD_PATH(path) \
4228 (path) = reparameterize_path_by_child(root, (path), child_rel); \
4229 if ((path) == NULL) \
4233 #define REPARAMETERIZE_CHILD_PATH_LIST(pathlist) \
4235 if ((pathlist) != NIL) \
4237 (pathlist) = reparameterize_pathlist_by_child(root, (pathlist), \
4239 if ((pathlist) == NIL) \
4248 if (!path->param_info ||
4269 if (path->
pathtype == T_SampleScan)
4271 Index scan_relid = path->parent->relid;
4290 new_path = (
Path *) ipath;
4294 case T_BitmapHeapPath:
4300 new_path = (
Path *) bhpath;
4304 case T_BitmapAndPath:
4309 new_path = (
Path *) bapath;
4313 case T_BitmapOrPath:
4318 new_path = (
Path *) bopath;
4335 path->parent->fdwroutine->ReparameterizeForeignPathByChild;
4339 new_path = (
Path *) fpath;
4357 new_path = (
Path *) cpath;
4369 new_path = (
Path *) npath;
4382 new_path = (
Path *) mpath;
4395 new_path = (
Path *) hpath;
4404 new_path = (
Path *) apath;
4408 case T_MaterialPath:
4413 new_path = (
Path *) mpath;
4423 new_path = (
Path *) mpath;
4432 new_path = (
Path *) gpath;
4446 old_ppi = new_path->param_info;
4450 child_rel->top_parent);
4460 if (new_ppi == NULL)
4479 new_path->param_info = new_ppi;
4510 #define REJECT_IF_PATH_NOT_REPARAMETERIZABLE(path) \
4512 if (!path_is_reparameterizable_by_child(path, child_rel)) \
4516 #define REJECT_IF_PATH_LIST_NOT_REPARAMETERIZABLE(pathlist) \
4518 if (!pathlist_is_reparameterizable_by_child(pathlist, child_rel)) \
4526 if (!path->param_info ||
4540 case T_BitmapHeapPath:
4548 case T_BitmapAndPath:
4556 case T_BitmapOrPath:
4600 case T_MaterialPath:
4646 foreach(lc, pathlist)
4657 result =
lappend(result, path);
4672 foreach(lc, pathlist)
Datum sort(PG_FUNCTION_ARGS)
bool query_is_distinct_for(Query *query, List *colnos, List *opids)
bool query_supports_distinctness(Query *query)
Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids, RelOptInfo *childrel, RelOptInfo *parentrel)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
BMS_Comparison bms_subset_compare(const Bitmapset *a, const Bitmapset *b)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
void bms_free(Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_del_members(Bitmapset *a, const Bitmapset *b)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
int bms_compare(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_copy(const Bitmapset *a)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
bool is_parallel_safe(PlannerInfo *root, Node *node)
double expression_returns_set_rows(PlannerInfo *root, Node *clause)
void final_cost_hashjoin(PlannerInfo *root, HashPath *path, JoinCostWorkspace *workspace, JoinPathExtraData *extra)
void final_cost_mergejoin(PlannerInfo *root, MergePath *path, JoinCostWorkspace *workspace, JoinPathExtraData *extra)
void cost_windowagg(Path *path, PlannerInfo *root, List *windowFuncs, WindowClause *winclause, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples)
void cost_functionscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_material(Path *path, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double tuples, int width)
void cost_bitmap_heap_scan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, Path *bitmapqual, double loop_count)
void cost_tidrangescan(Path *path, PlannerInfo *root, RelOptInfo *baserel, List *tidrangequals, ParamPathInfo *param_info)
void cost_agg(Path *path, PlannerInfo *root, AggStrategy aggstrategy, const AggClauseCosts *aggcosts, int numGroupCols, double numGroups, List *quals, int disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples, double input_width)
void cost_sort(Path *path, PlannerInfo *root, List *pathkeys, int input_disabled_nodes, Cost input_cost, double tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples)
void final_cost_nestloop(PlannerInfo *root, NestPath *path, JoinCostWorkspace *workspace, JoinPathExtraData *extra)
void cost_gather_merge(GatherMergePath *path, PlannerInfo *root, RelOptInfo *rel, ParamPathInfo *param_info, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double *rows)
void cost_recursive_union(Path *runion, Path *nrterm, Path *rterm)
void cost_tablefuncscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_samplescan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_gather(GatherPath *path, PlannerInfo *root, RelOptInfo *rel, ParamPathInfo *param_info, double *rows)
void cost_namedtuplestorescan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_valuesscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_incremental_sort(Path *path, PlannerInfo *root, List *pathkeys, int presorted_keys, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples)
void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root)
void cost_group(Path *path, PlannerInfo *root, int numGroupCols, double numGroups, List *quals, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples)
void cost_resultscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_bitmap_and_node(BitmapAndPath *path, PlannerInfo *root)
void cost_tidscan(Path *path, PlannerInfo *root, RelOptInfo *baserel, List *tidquals, ParamPathInfo *param_info)
void cost_merge_append(Path *path, PlannerInfo *root, List *pathkeys, int n_streams, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double tuples)
double clamp_row_est(double nrows)
void cost_subqueryscan(SubqueryScanPath *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info, bool trivial_pathtarget)
void cost_append(AppendPath *apath)
void cost_ctescan(Path *path, PlannerInfo *root, RelOptInfo *baserel, ParamPathInfo *param_info)
void cost_bitmap_or_node(BitmapOrPath *path, PlannerInfo *root)
void cost_index(IndexPath *path, PlannerInfo *root, double loop_count, bool partial_path)
bool is_projection_capable_path(Path *path)
bool equal(const void *a, const void *b)
List *(* ReparameterizeForeignPathByChild_function)(PlannerInfo *root, List *fdw_private, RelOptInfo *child_rel)
bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, List *restrictlist, List *exprlist, List *oprlist)
if(TABLE==NULL||TABLE_index==NULL)
void list_sort(List *list, list_sort_comparator cmp)
List * list_insert_nth(List *list, int pos, void *datum)
List * lappend(List *list, void *datum)
List * list_copy_head(const List *oldlist, int len)
List * lappend_int(List *list, int datum)
void list_free(List *list)
List * list_concat(List *list1, const List *list2)
List * lcons(void *datum, List *list)
Datum subpath(PG_FUNCTION_ARGS)
void pfree(void *pointer)
MemoryContext GetMemoryChunkContext(void *pointer)
#define CHECK_FOR_INTERRUPTS()
size_t get_hash_memory_limit(void)
#define IsA(nodeptr, _type_)
bool pathkeys_contained_in(List *keys1, List *keys2)
PathKeysComparison compare_pathkeys(List *keys1, List *keys2)
#define REPARAMETERIZE_CHILD_PATH_LIST(pathlist)
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)
static int append_startup_cost_compare(const ListCell *a, const ListCell *b)
SortPath * create_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, double limit_tuples)
TidPath * create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, Relids required_outer)
#define REPARAMETERIZE_CHILD_PATH(path)
GroupResultPath * create_group_result_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *havingqual)
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)
Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path)
UniquePath * create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SpecialJoinInfo *sjinfo)
static PathCostComparison compare_path_costs_fuzzily(Path *path1, Path *path2, double fuzz_factor)
bool path_is_reparameterizable_by_child(Path *path, RelOptInfo *child_rel)
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)
LimitPath * create_limit_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, Node *limitOffset, Node *limitCount, LimitOption limitOption, int64 offset_est, int64 count_est)
ProjectionPath * create_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
GatherMergePath * create_gather_merge_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *pathkeys, Relids required_outer, double *rows)
UpperUniquePath * create_upper_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, int numCols, double numGroups)
static bool pathlist_is_reparameterizable_by_child(List *pathlist, RelOptInfo *child_rel)
Relids calc_nestloop_required_outer(Relids outerrelids, Relids outer_paramrels, Relids innerrelids, Relids inner_paramrels)
Path * create_tablefuncscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Path * create_namedtuplestorescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
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)
#define REJECT_IF_PATH_LIST_NOT_REPARAMETERIZABLE(pathlist)
LockRowsPath * create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *rowMarks, int epqParam)
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
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)
static List * reparameterize_pathlist_by_child(PlannerInfo *root, List *pathlist, RelOptInfo *child_rel)
GatherPath * create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, Relids required_outer, double *rows)
Path * create_resultscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
Path * create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
MemoizePath * create_memoize_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *param_exprs, List *hash_operators, bool singlerow, bool binary_mode, double calls)
MergeAppendPath * create_merge_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *pathkeys, Relids required_outer)
void set_cheapest(RelOptInfo *parent_rel)
Path * reparameterize_path(PlannerInfo *root, Path *path, Relids required_outer, double loop_count)
ProjectSetPath * create_set_projection_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target)
SubqueryScanPath * create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, bool trivial_pathtarget, List *pathkeys, Relids required_outer)
void add_partial_path(RelOptInfo *parent_rel, Path *new_path)
MaterialPath * create_material_path(RelOptInfo *rel, Path *subpath)
Path * create_functionscan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
#define ADJUST_CHILD_ATTRS(node)
BitmapOrPath * create_bitmap_or_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
int compare_fractional_path_costs(Path *path1, Path *path2, double fraction)
GroupPath * create_group_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *groupClause, List *qual, double numGroups)
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)
GroupingSetsPath * create_groupingsets_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *having_qual, AggStrategy aggstrategy, List *rollups, const AggClauseCosts *agg_costs)
SetOpPath * create_setop_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, SetOpCmd cmd, SetOpStrategy strategy, List *distinctList, AttrNumber flagColIdx, int firstFlag, double numGroups, double outputRows)
#define REJECT_IF_PATH_NOT_REPARAMETERIZABLE(path)
RecursiveUnionPath * create_recursiveunion_path(PlannerInfo *root, RelOptInfo *rel, Path *leftpath, Path *rightpath, PathTarget *target, List *distinctList, int wtParam, double numGroups)
IncrementalSortPath * create_incremental_sort_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, List *pathkeys, int presorted_keys, double limit_tuples)
MinMaxAggPath * create_minmaxagg_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, List *mmaggregates, List *quals)
Path * create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
#define CONSIDER_PATH_STARTUP_COST(p)
WindowAggPath * create_windowagg_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, PathTarget *target, List *windowFuncs, List *runCondition, WindowClause *winclause, List *qual, bool topwindow)
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)
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)
void add_path(RelOptInfo *parent_rel, Path *new_path)
ModifyTablePath * create_modifytable_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, CmdType operation, bool canSetTag, Index nominalRelation, Index rootRelation, bool partColsUpdated, List *resultRelations, List *updateColnosLists, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, List *mergeActionLists, List *mergeJoinConditions, int epqParam)
Path * create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
int compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
bool add_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer)
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)
Path * apply_projection_to_path(PlannerInfo *root, RelOptInfo *rel, Path *path, PathTarget *target)
static int append_total_cost_compare(const ListCell *a, const ListCell *b)
BitmapAndPath * create_bitmap_and_path(PlannerInfo *root, RelOptInfo *rel, List *bitmapquals)
TidRangePath * create_tidrangescan_path(PlannerInfo *root, RelOptInfo *rel, List *tidrangequals, Relids required_outer)
Path * create_seqscan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer, int parallel_workers)
void adjust_limit_rows_costs(double *rows, Cost *startup_cost, Cost *total_cost, int64 offset_est, int64 count_est)
bool add_partial_path_precheck(RelOptInfo *parent_rel, int disabled_nodes, Cost total_cost, List *pathkeys)
static List * translate_sub_tlist(List *tlist, int relid)
Path * create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, List *pathkeys, Relids required_outer)
BitmapHeapPath * create_bitmap_heap_path(PlannerInfo *root, RelOptInfo *rel, Path *bitmapqual, Relids required_outer, double loop_count, int parallel_degree)
#define IS_SIMPLE_REL(rel)
#define PATH_REQ_OUTER(path)
#define planner_rt_fetch(rti, root)
static int list_length(const List *l)
#define foreach_current_index(var_or_cell)
#define foreach_delete_current(lst, var_or_cell)
MemoryContextSwitchTo(old_ctx)
static int cmp(const chr *x, const chr *y, size_t len)
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
ParamPathInfo * get_joinrel_parampathinfo(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, Relids required_outer, List **restrict_clauses)
ParamPathInfo * find_param_path_info(RelOptInfo *rel, Relids required_outer)
Bitmapset * get_param_path_clause_serials(Path *path)
double estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows, List **pgset, EstimationInfo *estinfo)
struct List *(* ReparameterizeCustomPathByChild)(PlannerInfo *root, List *custom_private, RelOptInfo *child_rel)
const struct CustomPathMethods * methods
List * custom_restrictinfo
ScanDirection indexscandir
List * withCheckOptionLists
List * mergeJoinConditions
OnConflictExpr * onconflict
struct TableSampleClause * tablesample
bool consider_param_startup
struct PathTarget * reltarget
List * cheapest_parameterized_paths
struct Path * cheapest_unique_path
struct Path * cheapest_startup_path
struct Path * cheapest_total_path