[SERVER-80359] [CQF] Make isLastRef more precise Created: 23/Aug/23 Updated: 28/Aug/23 Resolved: 28/Aug/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | David Percy | Assignee: | Backlog - Query Optimization |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| Description |
|
The default merge() behavior in reference_tracker.cpp misses some opportunities to mark a Variable as safe to move() from. When we get CollectedInfo from two subexpressions, we need to know the evaluation order to decide which side is evaluated last. The default merge() can't decide this, because for example BinaryOp and FunctionCall could be different. So we clear the last-reference flags from both sides: https://github.com/10gen/mongo/blob/master/src/mongo/db/query/optimizer/reference_tracker.cpp#L135 To decide the evaluation order of an ABT expression, you have to know:
I'm not sure if the evaluation order of an EExpression is well defined. I think this is supposed to be an implementation detail of the VM: |