[SERVER-83835] Make logical rewrites more granular Created: 04/Dec/23  Updated: 10/Jan/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Alya Berciu Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

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.


Generated at Thu Feb 08 06:53:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.