diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-03-15 12:28:54 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-03-15 12:41:00 -0400 |
commit | 5feb78ae885ce7ab134aad1d12875bd5103e5842 (patch) | |
tree | 668d5fb370c4193feeeddd49eccfee8d027b7c35 | |
parent | 18dc2aee5f303447bef48dee596a664d90f6939a (diff) | |
download | postgresql-5feb78ae885ce7ab134aad1d12875bd5103e5842.tar.gz postgresql-5feb78ae885ce7ab134aad1d12875bd5103e5842.zip |
Fix failure to use clamp_row_est() for parallel joins.
Commit 0c2070cefa0e5d097b715c9a3b9b5499470019aa neglected to use
clamp_row_est() where it should have done so.
Patch by me. Report by Amit Kapila.
Discussion: http://postgr.es/m/CAA4eK1KPm8RYa1Kun3ZmQj9pb723b-EFN70j47Pid1vn3ByquA@mail.gmail.com
-rw-r--r-- | src/backend/optimizer/path/costsize.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index cc708a6ffbc..3b5576694eb 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -1998,7 +1998,12 @@ final_cost_nestloop(PlannerInfo *root, NestPath *path, /* For partial paths, scale row estimate. */ if (path->path.parallel_workers > 0) - path->path.rows /= get_parallel_divisor(&path->path); + { + double parallel_divisor = get_parallel_divisor(&path->path); + + path->path.rows = + clamp_row_est(path->path.rows / parallel_divisor); + } /* * We could include disable_cost in the preliminary estimate, but that @@ -2420,7 +2425,12 @@ final_cost_mergejoin(PlannerInfo *root, MergePath *path, /* For partial paths, scale row estimate. */ if (path->jpath.path.parallel_workers > 0) - path->jpath.path.rows /= get_parallel_divisor(&path->jpath.path); + { + double parallel_divisor = get_parallel_divisor(&path->jpath.path); + + path->jpath.path.rows = + clamp_row_est(path->jpath.path.rows / parallel_divisor); + } /* * We could include disable_cost in the preliminary estimate, but that @@ -2803,7 +2813,12 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path, /* For partial paths, scale row estimate. */ if (path->jpath.path.parallel_workers > 0) - path->jpath.path.rows /= get_parallel_divisor(&path->jpath.path); + { + double parallel_divisor = get_parallel_divisor(&path->jpath.path); + + path->jpath.path.rows = + clamp_row_est(path->jpath.path.rows / parallel_divisor); + } /* * We could include disable_cost in the preliminary estimate, but that |