Re: Get rid of runtime handling of AlternativeSubPlan?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Get rid of runtime handling of AlternativeSubPlan?
Date: 2020-08-31 17:22:11
Message-ID: 4117348.1598894531@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> One inefficiency I see that we could probably get rid of is
> where make_subplan() is doing
> /* Now we can check if it'll fit in hash_mem */
> /* XXX can we check this at the Path stage? */

I went ahead and fixed that, and I also realized there's another small
improvement to be made: we can remove the unused SubPlan from the
subplans list of the finished PlannedStmt, by setting that list cell
to NULL. (This is already specifically allowed by the comments for
PlannedStmt.subplans.) Initially I supposed that this'd only save the
costs of copying that subtree when we copy the whole plan. On looking
closer, though, InitPlan actually runs ExecInitNode on every list
entry, even unused ones, so this will make some difference in executor
startup time.

Hence, an updated 0001 patch. 0002 hasn't changed.

regards, tom lane

Attachment Content-Type Size
0001-resolve-alternativesubplan-in-planner-2.patch text/x-diff 48.2 KB
0002-remove-alternativesubplan-executor-2.patch text/x-diff 9.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2020-08-31 17:26:59 Re: Ideas about a better API for postgres_fdw remote estimates
Previous Message Bruce Momjian 2020-08-31 17:08:17 Re: Ideas about a better API for postgres_fdw remote estimates