From 5864d6a4b62ada2ad60a8c456b4ee62972a9c10d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 14 Mar 2016 19:23:29 -0400 Subject: Provide a planner hook at a suitable place for creating upper-rel Paths. In the initial revision of the upper-planner pathification work, the only available way for an FDW or custom-scan provider to inject Paths representing post-scan-join processing was to insert them during scan-level GetForeignPaths or similar processing. While that's not impossible, it'd require quite a lot of duplicative processing to look forward and see if the extension would be capable of implementing the whole query. To improve matters for custom-scan providers, provide a hook function at the point where the core code is about to start filling in upperrel Paths. At this point Paths are available for the whole scan/join tree, which should reduce the amount of redundant effort considerably. (An alternative design that was suggested was to provide a separate hook for each post-scan-join processing step, but that seems messy and not clearly more useful.) Following our time-honored tradition, there's no documentation for this hook outside the source code. As-is, this hook is only meant for custom scan providers, which we can't assume very much about. A followon patch will implement an FDW callback to let FDWs do the same thing in a somewhat more structured fashion. --- src/include/optimizer/planner.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/include/optimizer') diff --git a/src/include/optimizer/planner.h b/src/include/optimizer/planner.h index 3fb7cb58cbd..a95e73fa93b 100644 --- a/src/include/optimizer/planner.h +++ b/src/include/optimizer/planner.h @@ -24,6 +24,11 @@ typedef PlannedStmt *(*planner_hook_type) (Query *parse, ParamListInfo boundParams); extern PGDLLIMPORT planner_hook_type planner_hook; +/* Hook for plugins to get control before grouping_planner plans upper rels */ +typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, + RelOptInfo *scan_join_rel); +extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook; + extern PlannedStmt *planner(Query *parse, int cursorOptions, ParamListInfo boundParams); -- cgit v1.2.3