Re: generic plans and "initial" pruning

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Daniel Gustafsson <daniel(at)yesql(dot)se>, David Rowley <dgrowleyml(at)gmail(dot)com>, Jacob Champion <jchampion(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Thom Brown <thom(at)linux(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: generic plans and "initial" pruning
Date: 2023-09-06 09:12:28
Message-ID: CA+HiwqGSmTE37MmERJREqnO=w5NQHLPutDoq4sAvvXQXWwUPCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 5, 2023 at 11:41 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Sep 5, 2023 at 3:13 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > Attached 0001 removes unnecessary cleanup calls from ExecEnd*() routines.
>
> It also adds a few random Assert()s to verify that unrelated pointers
> are not NULL. I suggest that it shouldn't do that.

OK, removed.

> The commit message doesn't mention the removal of the calls to
> ExecDropSingleTupleTableSlot. It's not clear to me why that's OK and I
> think it would be nice to mention it in the commit message, assuming
> that it is in fact OK.

That is not OK, so I dropped their removal. I think I confused them
with slots in other functions initialized with
ExecInitExtraTupleSlot() that *are* put into the estate.

> I suggest changing the subject line of the commit to something like
> "Remove obsolete executor cleanup code."

Sure.

> > 0002 adds NULLness checks in ExecEnd*() routines on some pointers that
> > may not be initialized by the corresponding ExecInit*() routines in
> > the case where it returns early.
>
> I think you should only add these where it's needed. For example, I
> think list_free_deep(NIL) is fine.

OK, done.

> The changes to ExecEndForeignScan look like they include stuff that
> belongs in 0001.

Oops, yes. Moved to 0001.

> Personally, I prefer explicit NULL-tests i.e. if (x != NULL) to
> implicit ones like if (x), but opinions vary.

I agree, so changed all the new tests to use (x != NULL) form.
Typically, I try to stick with whatever style is used in the nearby
code, though I can see both styles being used in the ExecEnd*()
routines. I opted to use the style that we both happen to prefer.

Attached updated patches. Thanks for the review.

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

Attachment Content-Type Size
v47-0005-Add-field-to-store-parent-relids-to-Append-Merge.patch application/octet-stream 21.2 KB
v47-0006-Set-inFromCl-to-false-in-child-table-RTEs.patch application/octet-stream 3.7 KB
v47-0008-Track-opened-range-table-relations-in-a-List-in-.patch application/octet-stream 2.4 KB
v47-0007-Delay-locking-of-child-tables-in-cached-plans-un.patch application/octet-stream 49.3 KB
v47-0004-Adjustments-to-allow-ExecutorStart-to-sometimes-.patch application/octet-stream 50.0 KB
v47-0003-Support-for-ExecInitNode-to-detect-CachedPlan-in.patch application/octet-stream 36.7 KB
v47-0002-Check-pointer-NULLness-before-cleanup-in-ExecEnd.patch application/octet-stream 5.9 KB
v47-0001-Remove-obsolete-executor-cleanup-code.patch application/octet-stream 30.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-09-06 09:26:44 Re: [PoC] pg_upgrade: allow to upgrade publisher node
Previous Message Richard Guo 2023-09-06 09:10:14 Re: Introduce join_info_array for direct lookups of SpecialJoinInfo by ojrelid