[SERVER-83425] [CQF] Only evaluate expressions deriving from getParam once during plan execution Created: 17/Nov/23  Updated: 30/Jan/24

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

Type: Task Priority: Major - P3
Reporter: Ben Shteinfeld 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   

When we enable parameterization, the bounds we generate in SargableNode (and lower to Filter + PhysicalScan or IxScan) contain expressions. In the case of M2 queries, we currently generate plans which evaluate these expressions on every document, despite being constant for the duration of the query.

We can modify lowerPartialSchemaRequirements() to generate a NLJ with Limit 1 CoScan as the outer child to evaluate these expressions once and expose them as a correlated projection.

We have concerns about the performance of such an approach, but since it is simple to implement, propose to measure the performance to verify our suspicions before embarking on a solution that might be more complex.


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