From: Tom Lane Date: Sat, 19 Nov 2016 20:06:45 +0000 (-0500) Subject: Fix latent costing error in create_merge_append_path. X-Git-Tag: REL_10_BETA1~1388 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=0832f2db68cc43524a240db47d0428cc9525723e;p=postgresql.git Fix latent costing error in create_merge_append_path. create_merge_append_path should use the path rowcount it just computed, not rel->tuples, for costing purposes. Those numbers should always be the same at present, but if we ever support parameterized MergeAppend paths (a case this function is otherwise prepared for), the former would be right and the latter wrong. No need for back-patch since the problem is only latent. Ashutosh Bapat Discussion: --- diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index abb7507d8e4..6d3ccfd20e4 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -1333,7 +1333,7 @@ create_merge_append_path(PlannerInfo *root, cost_merge_append(&pathnode->path, root, pathkeys, list_length(subpaths), input_startup_cost, input_total_cost, - rel->tuples); + pathnode->path.rows); return pathnode; }