Re: generic plans and "initial" pruning
Robert Haas <robertmhaas@gmail.com>
On Fri, Mar 11, 2022 at 9:35 AM Amit Langote <amitlangote09@gmail.com> wrote: > Attached is v5, now broken into 3 patches: > > 0001: Some refactoring of runtime pruning code > 0002: Add a plan_tree_walker > 0003: Teach AcquireExecutorLocks to skip locking pruned relations So is any other committer planning to look at this? Tom, perhaps? David? This strikes me as important work, and I don't mind going through and trying to do some detailed review, but (A) I am not the person most familiar with the code being modified here and (B) there are some important theoretical questions about the approach that we might want to try to cover before we get down into the details. In my opinion, the most important theoretical issue here is around reuse of plans that are no longer entirely valid, but the parts that are no longer valid are certain to be pruned. If, because we know that some parameter has some particular value, we skip locking a bunch of partitions, then when we're executing the plan, those partitions need not exist any more -- or they could have different indexes, be detached from the partitioning hierarchy and subsequently altered, whatever. That seems fine to me provided that all of our code (and any third-party code) is careful not to rely on the portion of the plan that we've pruned away, and doesn't assume that (for example) we can still fetch the name of an index whose OID appears in there someplace. I cannot think of a hazard where the fact that the part of a plan is no longer valid because some DDL has been executed "infects" the remainder of the plan. As long as we lock the partitioned tables named in the plan and their descendents down to the level just above the one at which something is pruned, and are careful, I think we should be OK. It would be nice to know if someone has a fundamentally different view of the hazards here, though. Just to state my position here clearly, I would be more than happy if somebody else plans to pick this up and try to get some or all of it committed, and will cheerfully defer to such person in the event that they have that plan. If, however, no such person exists, I may try my hand at that myself. Thanks, -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
Stamp 19beta1.
- 4b0bf0788b06 19 (unreleased) cited
-
Revert "Don't lock partitions pruned by initial pruning"
- 1722d5eb05d8 18.0 landed
-
Ensure first ModifyTable rel initialized if all are pruned
- 28317de723b6 18.0 cited
-
Fix bug in cbc127917 to handle nested Append correctly
- cbb9086c9ef6 18.0 landed
-
Remove unstable test suite added by 525392d57
- 4f1b6e5bb4fe 18.0 landed
-
Don't lock partitions pruned by initial pruning
- 525392d5727f 18.0 landed
-
Fix an oversight in cbc127917 to handle MERGE correctly
- 75dfde13639a 18.0 landed
-
Track unpruned relids to avoid processing pruned relations
- cbc127917e04 18.0 landed
-
Perform runtime initial pruning outside ExecInitNode()
- d47cbf474ecb 18.0 landed
-
Move PartitionPruneInfo out of plan nodes into PlannedStmt
- bb3ec16e14de 18.0 landed
-
Fix setrefs.c's failure to do expression processing on prune steps.
- bf826ea06297 18.0 cited
-
Remove obsolete executor cleanup code
- d060e921ea5a 17.0 landed
-
Revert "Move PartitionPruneInfo out of plan nodes into PlannedStmt"
- 5472743d9e85 16.0 landed
-
Move PartitioPruneInfo out of plan nodes into PlannedStmt
- ec386948948c 16.0 landed
-
Refactor and cleanup runtime partition prune code a little
- 297daa9d4353 15.0 landed
-
Remove some unnecessary fields from Plan trees.
- 52ed730d511b 12.0 cited
-
Remove more redundant relation locking during executor startup.
- f2343653f5b2 12.0 cited
-
Shut down Gather's children before shutting down Gather itself.
- acf555bc53ac 10.0 cited