Re: Append's first_partial_plan

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Subject: Re: Append's first_partial_plan
Date: 2018-04-17 21:30:11
Message-ID: CAKJS1f8N8M5SuTZWA_Dht3U+OBPm3P4RUzPOn-TCHkfLvVf_Lg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18 April 2018 at 07:52, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> While looking at this patch I became curious as to why do we even have
> first_partial_plan in the first place; it seems to require some strange
> contortions in the code. Wouldn't it be simpler to have two lists, one
> for non-partial and another for partial paths? I went to check the
> original discussion, and this design was indeed considered [1] -- but
> the idea was discarded because using the list index would lead to
> simpler code. However, now that we have pruning it seems to me that
> using the index isn't simpler anymore. Should we revisit this now?
>
> [1] https://www.postgresql.org/message-id/CA%2BTgmoZrjAB0bPzbtKgjP2uAP_6XAyuZenU54QuM7XGE_k2Q1g%40mail.gmail.com

I don't think having two Lists and/or two AppendState arrays would
make the pruning code anymore simple. All the pruning code in
execPartition.c would need to determine the index within the partial
or non-partial subnode array, and also communicate which array it
means. That code did take me a while to get right and be readable
too, I don't really want to have to change it again. I really don't
think it would look quite as simple as it does today either, so -1
from me for changing this.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2018-04-17 21:30:50 Re: pgsql: Support partition pruning at execution time
Previous Message Bruce Momjian 2018-04-17 21:29:17 Re: PostgreSQL's handling of fsync() errors is unsafe and risks data loss at least on XFS