For the two following SQL Statements:
SELECT *
FROM LargeTable
INNER JOIN SmallerTable ON LargeTable.ID = SmallTable.ID
WHERE SmallerTable.FilterField = ‘Sample’
LargeTable.FilterField = ‘Sample1’
SELECT *
FROM LargeTable
INNER JOIN SmallerTable ON LargeTable.ID = SmallTable.ID
WHERE LargeTable.FilterField = ‘Sample’
SmallerTable.FilterField = ‘Sample1'
Does precedence of the WHERE clause matter? If I specify the order of WHERE conditions in a different sequence will this positively/negatively impact performance. I know sub selects are more efficient when filtering data from a large data set before the join is done. Since the JOIN clause will only join the needed records not perform the join on all data then implement the WHERE.
What about the WHERE itself? Does SQL server filter in a certain order that can be taken advantage of for efficiency?
SELECT *
FROM LargeTable
INNER JOIN SmallerTable ON LargeTable.ID = SmallTable.ID
WHERE SmallerTable.FilterField = ‘Sample’
LargeTable.FilterField = ‘Sample1’
SELECT *
FROM LargeTable
INNER JOIN SmallerTable ON LargeTable.ID = SmallTable.ID
WHERE LargeTable.FilterField = ‘Sample’
SmallerTable.FilterField = ‘Sample1'
Does precedence of the WHERE clause matter? If I specify the order of WHERE conditions in a different sequence will this positively/negatively impact performance. I know sub selects are more efficient when filtering data from a large data set before the join is done. Since the JOIN clause will only join the needed records not perform the join on all data then implement the WHERE.
What about the WHERE itself? Does SQL server filter in a certain order that can be taken advantage of for efficiency?