On Fri, Dec 22, 2017 at 6:18 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> There doesn't seem to be any need for including spin.h. I think some
> prior version of the patch might need it. Patch attached to remove
> it.
OK, good catch.
> The code and comment don't seem to match. The comments indicate that
> after reaching the end of the list, we loop back to first nonpartial
> plan whereas code indicates that we loop back to first partial plan.
> I think one of those needs to be changed unless I am missing something
> obvious.
Yeah, the header comment should say partial, not nonpartial.
> 3.
> +cost_append(AppendPath *apath)
> {
> ..
> + /*
> + * 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.
> + */
> + if (i < apath->first_partial_path)
> + apath->path.rows += subpath->rows / parallel_divisor;
> + else
> + {
> + apath->path.rows += subpath->rows;
> + apath->path.total_cost += subpath->total_cost;
> + }
> ..
> }
>
> I think it is better to use clamp_row_est for rows for the case where
> we use parallel_divisor so that the value of rows is always sane.
Good point.
> Also, don't we need to use parallel_divisor for partial paths instead
> of non-partial paths as those will be actually distributed among
> workers?
Uh, that seems backwards to me. We're trying to estimate the average
number of rows per worker.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company