Re: generic plans and "initial" pruning
Robert Haas <robertmhaas@gmail.com>
Hi Amit, This is not a full review (sorry!) but here are a few comments. In general, I don't have a problem with this direction. I thought Tom's previous proposal of abandoning ExecInitNode() in medias res if we discover that we need to replan was doable and I still think that, but ISTM that this approach needs to touch less code, because abandoning ExecInitNode() partly through means we could have leftover state to clean up in any node in the PlanState tree, and as we've discussed, ExecEndNode() isn't necessarily prepared to clean up a PlanState tree that was only partially processed by ExecInitNode(). As far as I can see in the time I've spent looking at this today, 0001 looks pretty unobjectionable (with some exceptions that I've noted below). I also think 0003 looks pretty safe. It seems like partition pruning moves backward across a pretty modest amount of code that does pretty well-defined things. Basically, initialization-time pruning now happens before other types of node initialization, and before setting up row marks. I do however find the changes in 0002 to be less obviously correct and less obviously safe; see below for some notes about that. In 0001, the name root_parent_relids doesn't seem very clear to me, and neither does the explanation of what it does. You say "'root_parent_relids' identifies the relation to which both the parent plan and the PartitionPruneInfo given by 'part_prune_index' belong." But it's a set, so what does it mean to identify "the" relation? It's a set of relations, not just one. And why does the name include the word "root"? It's neither the PlannerGlobal object, which we often call root, nor is it the root of the partitioning hierarchy. To me, it looks like it's just the set of relids that we can potentially prune. I don't see why this isn't just called "relids", like the field from which it's copied: + pruneinfo->root_parent_relids = parentrel->relids; It just doesn't seem very root-y or very parent-y. - node->part_prune_info = partpruneinfo; + Extra blank line. In 0002, the handling of ExprContexts seems a little bit hard to understand. Sometimes we're using the PlanState's ExprContext, and sometimes we're using a separate context owned by the PartitionedRelPruningData's context, and it's not exactly clear why that is or what the consequences are. Likewise I wouldn't mind some more comments or explanation in the commit message of the changes in this patch related to EState objects. I can't help wondering if the changes here could have either semantic implications (like expression evaluation can produce different results than before) or performance implications (because we create objects that we didn't previously create). As noted above, this is really my only design-level concern about 0001-0003. Typo: partrtitioned Regrettably, I have not looked seriously at 0004 and 0005, so I can't comment on those. -- 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