-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
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:
- How it's lowered to an SBE EExpression
- The evaluation order for that EExpression
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: SERVER-68222.