File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -446,10 +446,9 @@ choose_next_subplan_for_leader(AppendState *node)
446
446
*
447
447
* We start from the first plan and advance through the list;
448
448
* when we get back to the end, we loop back to the first
449
- * nonpartial plan. This assigns the non-partial plans first
450
- * in order of descending cost and then spreads out the
451
- * workers as evenly as possible across the remaining partial
452
- * plans.
449
+ * partial plan. This assigns the non-partial plans first in
450
+ * order of descending cost and then spreads out the workers
451
+ * as evenly as possible across the remaining partial plans.
453
452
* ----------------------------------------------------------------
454
453
*/
455
454
static bool
Original file line number Diff line number Diff line change @@ -1883,18 +1883,26 @@ cost_append(AppendPath *apath)
1883
1883
subpath -> startup_cost );
1884
1884
1885
1885
/*
1886
- * Apply parallel divisor to non-partial subpaths. Also add the
1887
- * cost of partial paths to the total cost, but ignore non-partial
1888
- * paths for now.
1886
+ * Apply parallel divisor to subpaths. Scale the number of rows
1887
+ * for each partial subpath based on the ratio of the parallel
1888
+ * divisor originally used for the subpath to the one we adopted.
1889
+ * Also add the cost of partial paths to the total cost, but
1890
+ * ignore non-partial paths for now.
1889
1891
*/
1890
1892
if (i < apath -> first_partial_path )
1891
1893
apath -> path .rows += subpath -> rows / parallel_divisor ;
1892
1894
else
1893
1895
{
1894
- apath -> path .rows += subpath -> rows ;
1896
+ double subpath_parallel_divisor ;
1897
+
1898
+ subpath_parallel_divisor = get_parallel_divisor (subpath );
1899
+ apath -> path .rows += subpath -> rows * (subpath_parallel_divisor /
1900
+ parallel_divisor );
1895
1901
apath -> path .total_cost += subpath -> total_cost ;
1896
1902
}
1897
1903
1904
+ apath -> path .rows = clamp_row_est (apath -> path .rows );
1905
+
1898
1906
i ++ ;
1899
1907
}
1900
1908
Original file line number Diff line number Diff line change 21
21
#include "lib/pairingheap.h"
22
22
#include "nodes/params.h"
23
23
#include "nodes/plannodes.h"
24
- #include "storage/spin.h"
25
24
#include "utils/hsearch.h"
26
25
#include "utils/queryenvironment.h"
27
26
#include "utils/reltrigger.h"
You can’t perform that action at this time.
0 commit comments