[SERVER-81888] Path fusion rewrite to mark the root of any constant path subtree as constant Created: 05/Oct/23 Updated: 09/Jan/24 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Alya Berciu | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | M9 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query Optimization
|
||||||||
| Participants: | |||||||||
| Description |
|
The motivation is related to Drop "a" * Field "a" p Where p is some arbitrary path. If we try to convert to MakeObjSpec, we will fail to translate the PathComposeM because there is no way to encode "pass Nothing to p and set field 'a' to the output". This sort of path comes up when we have consecutive projection stages where we exclude a path and then set that path to something else. Because we fail to translate, we will fallback to lowering, which is provably slow. We can do better. Note the following: Drop "a" = Field "a" Const Nothing If we can perform this rewrite, e.g. by setting the child of PathConst to (Const Nothing * p), then we can definitely translate a path of the form Field "a" Const c to MakeObjSpec/ get a better plan.
|