Re: parallel index(-only) scan breaks when run without parallelism

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Rafia Sabih <rafia(dot)sabih(at)enterprisedb(dot)com>
Subject: Re: parallel index(-only) scan breaks when run without parallelism
Date: 2017-03-08 07:28:38
Message-ID: CAA4eK1Kq5qb_u2AOoda5XBB91vVWz90w=LgtRLgsssriS8pVTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 8, 2017 at 12:27 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Amit, Rafia,
>
> nodeIndexscan.c, unlike nodeSeqscan.c, thinks that a parallel-aware
> scan will always be executed in parallel mode. But that's not true:
> an Execute message with a non-zero row count could cause us to abandon
> planned parallelism and execute the plan serially.
>

Right, and the current code had assumed that if there is a parallel
plan then it will always enter the parallel mode. I think the fix is
quite similar to what we do in nodeSeqscan.c i.e. initialize the scan
descriptor before starting the scan if it is not already initialized.
There is an additional check required for ensuring if index runtime
keys are ready before calling index_rescan. Attached patch fixes the
problem.

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

Attachment Content-Type Size
fix_scandesc_initialization_parallel_index_v1.patch application/octet-stream 8.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-03-08 07:34:06 Re: Enabling replication connections by default in pg_hba.conf
Previous Message Amit Khandekar 2017-03-08 07:00:16 Re: Parallel Append implementation