Documentation / Extension Hooks / Query planning
create_upper_paths_hook
create_upper_paths_hook
Hook for plugins to get control when grouping_planner() plans upper rels
Reading PostgreSQL 18.
Description
Hook for plugins to get control when grouping_planner() plans upper rels
- Interface type
- create_upper_paths_hook_type
- Header
- src/include/optimizer/planner.h
- Subsystem
- Query planning
- Initial value
- NULL (no hook installed)
C interface
typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, UpperRelationKind stage, RelOptInfo *input_rel, RelOptInfo *output_rel, void *extra);
extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook;Core source comments
Let extensions possibly add some more paths
Let extensions possibly add some more partial paths
Call sites
src/backend/optimizer/plan/planner.c:2386
src/backend/optimizer/plan/planner.c:4379
src/backend/optimizer/plan/planner.c:4819
src/backend/optimizer/plan/planner.c:5062
src/backend/optimizer/plan/planner.c:5237
src/backend/optimizer/plan/planner.c:5707
Core call context: src/backend/optimizer/plan/planner.c:2380–2394
final_rel->fdwroutine->GetForeignUpperPaths(root, UPPERREL_FINAL,
current_rel, final_rel,
&extra);
/* Let extensions possibly add some more paths */
if (create_upper_paths_hook)
(*create_upper_paths_hook) (root, UPPERREL_FINAL,
current_rel, final_rel, &extra);
/* Note: currently, we leave it to callers to do set_cheapest() */
}
/*
* Do preprocessing for groupingSets clause and related data.
*Core call context: src/backend/optimizer/plan/planner.c:4373–4387
grouped_rel->fdwroutine->GetForeignUpperPaths(root, UPPERREL_GROUP_AGG,
input_rel, grouped_rel,
extra);
/* Let extensions possibly add some more paths */
if (create_upper_paths_hook)
(*create_upper_paths_hook) (root, UPPERREL_GROUP_AGG,
input_rel, grouped_rel,
extra);
}
/*
* For a given input path, consider the possible ways of doing grouping sets on
* it, by combinations of hashing and sorting. This can be called multiple
* times, so it's important that it not scribble on input. No result isCore call context: src/backend/optimizer/plan/planner.c:4813–4827
window_rel->fdwroutine->GetForeignUpperPaths(root, UPPERREL_WINDOW,
input_rel, window_rel,
NULL);
/* Let extensions possibly add some more paths */
if (create_upper_paths_hook)
(*create_upper_paths_hook) (root, UPPERREL_WINDOW,
input_rel, window_rel, NULL);
/* Now choose the best path(s) */
set_cheapest(window_rel);
return window_rel;
}
Related entries
Documentation and source
Source build
- Version
- 18
- Build
- REL_18_STABLE
- Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd
Related entries
get_relation_info_hookget_relation_info_hookjoin_search_hookjoin_search_hookplanner_hookplanner_hookset_join_pathlist_hookset_join_pathlist_hookset_rel_pathlist_hookset_rel_pathlist_hook
Back to Extension Hooks · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.