Re: Parallel execution and prepared statements

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Parallel execution and prepared statements
Date: 2016-11-17 15:39:18
Message-ID: CA+TgmoYh50RQ2cbRp9H+rGb9=A935LnM4vThP8StQx69QnwzrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 17, 2016 at 10:07 AM, Tobias Bussmann <t(dot)bussmann(at)gmx(dot)net> wrote:
>> Yeah, we could do something like this, perhaps not in exactly this
>> way, but I'm not sure it's a good idea to just execute the parallel
>> plan without workers.
>
> sure, executing parallel plans w/o workers seems a bit of a hack. But:
> - we already do it this way in some other situations

True, but we also try to avoid it whenever possible, because it's
likely to lead to poor performance.

> - the alternative in this special situation would be to _force_ replanning without the CURSOR_OPT_PARALLEL_OK. The decision for replanning is hidden deep within plancache.c and while we could influence it with CURSOR_OPT_CUSTOM_PLAN this wouldn't have an effect if the prepared statement doesn't have any parameters. Additionally, influencing the decision and generating a non-parallel plan would shift the avg cost calculation used to choose custom or generic plans.

I think it would be a good idea to come up with a way for a query to
produce both a parallel and a non-parallel plan and pick between them
at execution time. However, that's more work than I've been willing
to undertake.

--
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 Karl O. Pinc 2016-11-17 15:43:34 Re: Patch to implement pg_current_logfile() function
Previous Message Robert Haas 2016-11-17 15:37:14 Re: Fun fact about autovacuum and orphan temp tables