From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, David Rowley <dgrowleyml(at)gmail(dot)com>, Jacob Champion <jchampion(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: generic plans and "initial" pruning |
Date: | 2023-06-08 14:23:21 |
Message-ID: | CA+HiwqEAHH=_PVG87rSHhQxmbHQ1dxSd58BVg=dHHfsgCeQFHw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Here is a new version. Summary of main changes since the last version
that Tom reviewed back in April:
* ExecInitNode() subroutines now return NULL (as opposed to a
partially initialized PlanState node as in the last version) upon
detecting that the CachedPlan that the plan tree is from is no longer
valid due to invalidation messages processed upon taking locks. Plan
tree subnodes that are fully initialized till the point of detection
are added by ExecInitNode() into a List in EState called
es_inited_plannodes. ExecEndPlan() now iterates over that list to
close each one individually using ExecEndNode(). ExecEndNode() or its
subroutines thus no longer need to be recursive to close the child
nodes. Also, with this design, there is no longer the possibility of
partially initialized PlanState trees with partially initialized
individual PlanState nodes, so the ExecEndNode() subroutine changes
that were in the last version to account for partial initialization
are not necessary.
* Instead of setting EXEC_FLAG_GET_LOCKS in es_top_eflags for the
entire duration of InitPlan(), it is now only set in ExecInitAppend()
and ExecInitMergeAppend(), because that's where the subnodes scanning
child tables would be and the executor only needs to lock child tables
to validate a CachedPlan in a race-free manner. Parent tables that
appear in the query would have been locked by AcquirePlannerLocks().
Child tables whose scan subnodes don't appear under Append/MergeAppend
(due to the latter being removed by setrefs.c for there being only a
single child) are identified in PlannedStmt.elidedAppendChildRelations
and InitPlan() locks each one found there if the plan tree is from a
CachedPlan.
* There's no longer PlannedStmt.viewRelations, because view relations
need not be tracked separately for locking as AcquirePlannerLocks()
covers them.
Attachment | Content-Type | Size |
---|---|---|
v39-0004-Track-opened-range-table-relations-in-a-List-in-.patch | application/octet-stream | 2.3 KB |
v39-0002-Add-a-PlannedStmt-field-to-store-RT-indexes-of-o.patch | application/octet-stream | 6.4 KB |
v39-0001-Add-field-to-store-partitioned-relids-to-Append-.patch | application/octet-stream | 21.4 KB |
v39-0003-Delay-locking-of-child-tables-in-cached-plans-un.patch | application/octet-stream | 125.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2023-06-08 14:31:05 | Re: Named Prepared statement problems and possible solutions |
Previous Message | Alvaro Herrera | 2023-06-08 14:21:55 | Re: Cleaning up nbtree after logical decoding on standby work |