|
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.
|