Re: generic plans and "initial" pruning

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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>, 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: 2024-12-05 12:03:09
Message-ID: CA+HiwqGAvRktFbTf7J+Dqg_jaTGJO664p9MCSVdMhHers7udhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 4, 2024 at 10:34 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> I'll post the updated patches tomorrow.

Here is an updated set.

I said that Assert suffices in ExecInitPartitionPruning() but on
further thought and after finding the following in ExecInitExprRec()
that an elog() won't hurt.

/* planner messed up */
elog(ERROR, "Aggref found in non-Agg plan node");

Like this:

+ /* Obtain the pruneinfo we need. */
+ pruneinfo = list_nth_node(PartitionPruneInfo, estate->es_part_prune_infos,
+ part_prune_index);
+
+ /* Its relids better match the plan node's or the planner messed up. */
+ if (!bms_equal(relids, pruneinfo->relids))
+ elog(ERROR, "wrong pruneinfo with relids=%s found at
part_prune_index=%d contained in plan node with relids=%s",
+ bmsToString(pruneinfo->relids), part_prune_index,
+ bmsToString(relids));

I've merged what were 0004 and 0005 in v57 together because they would
be eventually committed together and I wanted to write a unified
commit message.

One notable change is that I've renamed ExecutorStartExt() to
ExecutorStartCachedPlan() and changed its callers to only call it if a
CachedPlan is available, calling ExecutorStart() otherwise.

I'm still looking at Tomas's perf numbers and haven't confirmed some
of the findings myself.

--
Thanks, Amit Langote

Attachment Content-Type Size
v58-0001-Move-PartitionPruneInfo-out-of-plan-nodes-into-P.patch application/octet-stream 20.4 KB
v58-0002-Initialize-PartitionPruneContexts-lazily.patch application/octet-stream 16.9 KB
v58-0003-Perform-runtime-initial-pruning-outside-ExecInit.patch application/octet-stream 14.6 KB
v58-0004-Defer-locking-of-runtime-prunable-relations-in-c.patch application/octet-stream 111.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-12-05 12:15:52 Re: MinGW compiler warnings in ecpg tests
Previous Message Kirill Reshke 2024-12-05 11:44:43 Re: CREATE TABLE NOT VALID for check and foreign key