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>, 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-09-20 08:10:03 |
Message-ID: | CA+HiwqE7+iwMH4NYtFi28Pt9fT_gRW+Gt-=CvOX=Pkquo=AN8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Sep 19, 2024 at 9:10 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Thu, Sep 19, 2024 at 5:39 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > For
> > ResultRelInfos, I took the approach of memsetting them to 0 for pruned
> > result relations and adding checks at multiple sites to ensure the
> > ResultRelInfo being handled is valid.
>
> After some reflection,
Not enough reflection, evidently...
> I realized that nobody would think that that
> approach is very robust. In the attached, I’ve modified
> ExecInitModifyTable() to allocate ResultRelInfos only for unpruned
> relations, instead of allocating for all in
> ModifyTable.resultRelations and setting pruned ones to 0. This
> approach feels more robust.
Except, I forgot that ModifyTable has other lists that parallel
resultRelations (of the same length) viz. withCheckOptionLists,
returningLists, and updateColnosLists, which need to be similarly
truncated to only consider unpruned relations. I've updated 0004 to
do so. This was broken even in the other design where locking is
delayed all the way until ExecInitAppend does initial pruning(),
because ResultRelInfos are created before initializing the plan
subtree containing the Append node, which would try to lock and open
*all* partitions.
Also, I've switched the order of 0002 and 0003 to avoid a situation
where I add a function in 0002 only to remove it in 0003. By doing
the refactoring to initialize PartitionPruneContexts lazily first, the
patch to move the initial pruning to occur before ExecInitNode()
became much simpler as it doesn't need to touch the code related to
exec pruning.
--
Thanks, Amit Langote
Attachment | Content-Type | Size |
---|---|---|
v56-0005-Handle-CachedPlan-invalidation-in-the-executor.patch | application/octet-stream | 58.0 KB |
v56-0002-Initialize-PartitionPruneContexts-lazily.patch | application/octet-stream | 15.6 KB |
v56-0001-Move-PartitionPruneInfo-out-of-plan-nodes-into-P.patch | application/octet-stream | 19.9 KB |
v56-0004-Defer-locking-of-runtime-prunable-relations-to-e.patch | application/octet-stream | 52.0 KB |
v56-0003-Perform-runtime-initial-pruning-outside-ExecInit.patch | application/octet-stream | 10.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2024-09-20 08:27:28 | Re: not null constraints, again |
Previous Message | Alvaro Herrera | 2024-09-20 07:32:27 | Re: not null constraints, again |