Re: Wired if-statement in gen_partprune_steps_internal

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wired if-statement in gen_partprune_steps_internal
Date: 2021-04-07 12:49:17
Message-ID: CA+HiwqFQnwuhkWdBnUDiuz1N7T34eZetN9HyNAJCp9MhxXRrcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 7, 2021 at 8:44 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> On Wed, 7 Apr 2021 at 21:53, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> > If canonicalize_qual() had been unable to rewrite that WHERE clause
> > then I could see that we might want to combine steps from other
> > recursive quals. I'm thinking right now that I'm glad
> > canonicalize_qual() does that hard work for us. (I think partprune.c
> > could handle the original WHERE clause as-is in this example
> > anyway...)
>
> I made a pass over the v2 patch and since it's been a long time since
> I'd looked at partprune.c I ended doing further rewriting of the
> comments you'd changed.
>
> There's only one small code change as I didn't like the following:
>
> - return result;
> + /* A single step or no pruning possible with the provided clauses. */
> + return steps ? linitial(steps) : NULL;
>
> I ended up breaking that out into an if condition.
>
> All the other changes are around the comments.
>
> Can you look over this and let me know if you're happy with the changes?

Thanks David. Actually, I was busy updating the patch to revert to
gen_partprune_steps_internal() returning a list and was almost done
with it when I saw your message.

I read through v3 and can say that it certainly looks better than v2.
If you are happy with gen_partprune_steps_internal() no longer
returning a list, I would not object if you wanted to go ahead and
commit the v3.

I've attached the patch I had ended up with and was about to post as
v3, just in case you wanted to glance.

--
Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v3_amit.diff application/octet-stream 11.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robins Tharakan 2021-04-07 12:55:53 Re: buildfarm instance bichir stuck
Previous Message Nitin Jadhav 2021-04-07 12:47:11 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?