Re: Observations in Parallel Append

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Observations in Parallel Append
Date: 2017-12-24 06:36:08
Message-ID: CA+TgmoZ-WSVh5hS7+g0+Hd9XLrsjv1v=VEq_mNme_MF4mAda0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 22, 2017 at 6:18 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-12-24 08:12:27 Re: General purpose hashing func in pgbench
Previous Message Craig Ringer 2017-12-24 04:51:52 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions