-
Type: Task
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
Logical rewrites could in some cases be more granular, e.g. FilterSubstitute. Splitting larger rewrites up would allow us to:
- configure sub-rewrites up front during phase manager construction, e.g. NotPushdown could be disabled once at the start of optimization, rather than having a check for it ever time we try to apply FilterSubstitute to a FilterNode.
- reuse sub-rewrites when we have alternate sets of phases and rewrites that we want to apply in different scenarios, as was proposed in
SERVER-83456 - needed for
SERVER-80735 - this also has the side-benefit of reducing code duplication
The first thing to implement is the ability to apply the same rewrite struct (e.g. SubstituteConvert) to the same type of node multiple times. This would require the introduction of an additional template parameter to distinguish between SubstituteConvert/FilterNode combinations.
The second would be to ensure 1) ordering of rewrites and 2) that we only run each rewrite once per node.
A possible future improvement is for rewrites to be able to schedule (or maybe unschedule) other rewrites once they run.