aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorEtsuro Fujita <efujita@postgresql.org>2019-05-09 18:39:23 +0900
committerEtsuro Fujita <efujita@postgresql.org>2019-05-09 18:39:23 +0900
commitedbcbe277d795ecc339b0e4fa29bae42ce1a7be9 (patch)
tree54f2a822cf33f9dbe451c771a8799b9ba1477097 /src/backend/optimizer/plan/planner.c
parent47a338cfcd67139a1f91892b080934fcfc3aea03 (diff)
downloadpostgresql-edbcbe277d795ecc339b0e4fa29bae42ce1a7be9.tar.gz
postgresql-edbcbe277d795ecc339b0e4fa29bae42ce1a7be9.zip
postgres_fdw: Fix cost estimation for aggregate pushdown.
In commit 7012b132d0, which added support for aggregate pushdown in postgres_fdw, the expense of evaluating the final scan/join target computed by make_group_input_target() was not accounted for at all in costing aggregate pushdown paths with local statistics. The right fix for this would be to have a separate upper stage to adjust the final scan/join relation (see comments for apply_scanjoin_target_to_paths()); but for now, fix by adding the tlist eval cost when costing aggregate pushdown paths with local statistics. Apply this to HEAD only to avoid destabilizing existing plan choices. Author: Etsuro Fujita Reviewed-By: Antonin Houska Discussion: https://postgr.es/m/5C66A056.60007%40lab.ntt.co.jp
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index eb6f5a354dc..48005434d40 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -7113,6 +7113,10 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
* confused in createplan.c if they don't agree. We must do this now so
* that any append paths made in the next part will use the correct
* pathtarget (cf. create_append_path).
+ *
+ * Note that this is also necessary if GetForeignUpperPaths() gets called
+ * on the final scan/join relation or on any of its children, since the
+ * FDW might look at the rel's target to create ForeignPaths.
*/
rel->reltarget = llast_node(PathTarget, scanjoin_targets);