1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-21 12:05:57 +03:00

postgres_fdw: Fix test for cached costs in estimate_path_cost_size().

estimate_path_cost_size() failed to re-use cached costs when the cached
startup/total cost was 0, so it calculated the costs redundantly.

This is an oversight in commit aa09cd242f; but apply the patch to HEAD
only because there are no reports of actual trouble from that.

Author: Etsuro Fujita
Discussion: https://postgr.es/m/5C4AF3F3.4060409%40lab.ntt.co.jp
This commit is contained in:
Etsuro Fujita 2019-01-29 12:27:13 +09:00
parent e0c2933a76
commit 449d0a8550

View File

@ -2625,7 +2625,7 @@ estimate_path_cost_size(PlannerInfo *root,
* bare scan each time. Instead, use the costs if we have cached them * bare scan each time. Instead, use the costs if we have cached them
* already. * already.
*/ */
if (fpinfo->rel_startup_cost > 0 && fpinfo->rel_total_cost > 0) if (fpinfo->rel_startup_cost >= 0 && fpinfo->rel_total_cost >= 0)
{ {
startup_cost = fpinfo->rel_startup_cost; startup_cost = fpinfo->rel_startup_cost;
run_cost = fpinfo->rel_total_cost - fpinfo->rel_startup_cost; run_cost = fpinfo->rel_total_cost - fpinfo->rel_startup_cost;