Re: Parallel Seq Scan

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel Seq Scan
Date: 2015-04-08 12:12:07
Message-ID: CAA4eK1KNYQtcB78o46prtrJknGGorRwAFgU4JPT9qMZ7YcKhbQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 8, 2015 at 3:30 PM, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On 8 April 2015 at 15:46, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>
>> I think there is always a chance that resources (like parallel-workers)
>> won't be available at run-time even if we decide about them at
>> executor-start phase unless we block it for that node's usage and OTOH
>> if we block it (by allocating) those resources during executor-start
phase
>> then we might end up blocking it too early or may be they won't even get
>> used if we decide not to execute that node. On that basis, it seems to
>> me current strategy is not bad where we decide during planning time and
>> later during execution time if not all resources (particularly
parallel-workers)
>> are not available, then we use only the available one's to execute the
plan.
>> Going forward, I think we can improve the same if we decide not to
shutdown
>> parallel workers till postmaster shutdown once they are started and
>> then just allocate them during executor-start phase.
>>
>>
>
> Yeah, but what about when workers are not available in cases when the
plan was only a win because the planner thought there would be lots of
workers... There could have been a more optimal serial plan already thrown
out by the planner which is no longer available to the executor.
>

That could also happen even if we decide in executor-start phase.
I agree that there is a chance of loss incase appropriate resources
are not available during execution, but same is true for work_mem
as well for a non-parallel plan. I think we need some advanced way
to handle the case when resources are not available during execution
by either re-planing the statement or by some other way, but that can
also be done separately.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2015-04-08 12:17:04 Re: Replication identifiers, take 4
Previous Message Fujii Masao 2015-04-08 12:04:50 Re: Removal of FORCE option in REINDEX