fix-postgres-fdw-grouping-path-cost.patch

text/x-patch

Filename: fix-postgres-fdw-grouping-path-cost.patch
Type: text/x-patch
Part: 0
Message: Re: postgres_fdw: oddity in costing aggregate pushdown paths

Patch

Format: context
File+
contrib/postgres_fdw/postgres_fdw.c 1 0
*** a/contrib/postgres_fdw/postgres_fdw.c
--- b/contrib/postgres_fdw/postgres_fdw.c
***************
*** 2937,2943 **** estimate_path_cost_size(PlannerInfo *root,
  			run_cost = ofpinfo->rel_total_cost - ofpinfo->rel_startup_cost;
  			run_cost += aggcosts.finalCost * numGroups;
  			run_cost += cpu_tuple_cost * numGroups;
! 			run_cost += ptarget->cost.per_tuple * numGroups;
  
  			/* Accout for the eval cost of HAVING quals, if any */
  			if (root->parse->havingQual)
--- 2937,2943 ----
  			run_cost = ofpinfo->rel_total_cost - ofpinfo->rel_startup_cost;
  			run_cost += aggcosts.finalCost * numGroups;
  			run_cost += cpu_tuple_cost * numGroups;
! 			run_cost += ptarget->cost.per_tuple * rows;
  
  			/* Accout for the eval cost of HAVING quals, if any */
  			if (root->parse->havingQual)