terrajobst/nquery

Decorrelation is performed before NullScanOptimization

Opened this issue · 0 comments

Ported from CodePlex

The following query should be better optimized. The filter should have been pulled out and LSJ should have been removed.

SELECT  *
FROM    [Order Details] od
WHERE   NOT EXISTS (
            SELECT  MAX(o.OrderDate)
            FROM    Orders o
            WHERE   o.OrderID = od.OrderID
        )
OR      od.OrderID > 100

The problem is that that decorrelation is done before NullScanOptimization so that the decorrelation cannot pull out the filter.