[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:

  1. How it's lowered to an SBE EExpression
  2. 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.


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