*
* We start from the first plan and advance through the list;
* when we get back to the end, we loop back to the first
- * nonpartial plan. This assigns the non-partial plans first
- * in order of descending cost and then spreads out the
- * workers as evenly as possible across the remaining partial
- * plans.
+ * partial plan. This assigns the non-partial plans first in
+ * order of descending cost and then spreads out the workers
+ * as evenly as possible across the remaining partial plans.
* ----------------------------------------------------------------
*/
static bool
subpath->startup_cost);
/*
- * Apply parallel divisor to non-partial subpaths. Also add the
- * cost of partial paths to the total cost, but ignore non-partial
- * paths for now.
+ * Apply parallel divisor to subpaths. Scale the number of rows
+ * for each partial subpath based on the ratio of the parallel
+ * divisor originally used for the subpath to the one we adopted.
+ * Also add the cost of partial paths to the total cost, but
+ * ignore non-partial paths for now.
*/
if (i < apath->first_partial_path)
apath->path.rows += subpath->rows / parallel_divisor;
else
{
- apath->path.rows += subpath->rows;
+ double subpath_parallel_divisor;
+
+ subpath_parallel_divisor = get_parallel_divisor(subpath);
+ apath->path.rows += subpath->rows * (subpath_parallel_divisor /
+ parallel_divisor);
apath->path.total_cost += subpath->total_cost;
}
+ apath->path.rows = clamp_row_est(apath->path.rows);
+
i++;
}
#include "lib/pairingheap.h"
#include "nodes/params.h"
#include "nodes/plannodes.h"
-#include "storage/spin.h"
#include "utils/hsearch.h"
#include "utils/queryenvironment.h"
#include "utils/reltrigger.h"