Re-fix wrong costing of Sort under Gather Merge.

Commit dc02c7bca4 changed this call
to create_sort_path() to take -1 rather than limit_tuples because,
at that time, there was no way for a Sort beneath a Gather Merge
to become a top-N sort.

Later, commit 3452dc5240 provided
a way for a Sort beneath a Gather Merge to become a top-N sort,
but failed to revert the previous commit in the process.  Do that.

Report and analysis by Jeff Janes; patch by Thomas Munro; review by
Amit Kapila and by me.

Discussion: http://postgr.es/m/CAEepm=1BWtC34vUroA0Uqjw02MaqdUrW+d6WD85_k8SLyPiKHQ@mail.gmail.com
This commit is contained in:
Robert Haas 2017-12-19 10:34:35 -05:00
parent 09a65f5a28
commit 38fc54703e
1 changed files with 1 additions and 1 deletions

View File

@ -5059,7 +5059,7 @@ create_ordered_paths(PlannerInfo *root,
ordered_rel,
cheapest_partial_path,
root->sort_pathkeys,
-1.0);
limit_tuples);
total_groups = cheapest_partial_path->rows *
cheapest_partial_path->parallel_workers;