Move stripping of subqueries to the end of planning.
Seems more straightforward. Firstly, modifying a PlannedStmt at execution is dubious, if the PlannedStmt is reused for executing the same query again. Secondly, if the original Query objects are indeed not needed after planning, we can save a little bit of memory, and avoid the overhead of stripping the plan on every execution. This also makes any breakage more obvious, if it turns out that the Query is actually still needed at execution for some reason, as that issue would then show up on the first execution already, and not only on reuse of a PlannedStmt. Per Kenan Yao's observation that stripPlanBeforeDispatch() also scribbles on the PlannedStmt.
Showing
想要评论请 注册 或 登录