I have a query that takes long time to complete and that I don't want to execute if some variable is false.
DECLARE @b = 0
SELECT *
FROM DummyTable
WHERE @b = 1
However, it still takes a lot of time to complete while I expect Constant Scan to be executed first:
My expectation is:
SELECT *
FROM DummyTable
WHERE 0 = 1
With execution plan:

