I want to have a parameter optionally excluding pricing information in a query. I've designed it to exclude information by shortcutting an evaluation to false. Which of these two would be faster and why?
DECLARE @fetchPricingData = 'No'
Example 1, shortcut to false in Join Condition:
SELECT...
FROM myTable
FULL JOIN (...) AS derivedPricingTable
ON derivedPricingTable.key = myTable.key
AND @fetchPricingData = 'Yes'
Example 2, shortcut to false in the Where Clause:
SELECT...
FROM myTable
FULL JOIN (
SELECT ...
FROM pricing_info
WHERE @fetchPricingData = 'Yes'
) AS derivedPricingTable
ON derivedPricingTable.key = myTable.key