Identifying OR Clauses
The next statements the Query Optimizer looks for in the query are OR
clauses. OR
clauses are SARGable expressions combined with an OR
condition rather than an AND
condition and are treated differently than standard SARGs. The format of an OR
clause is with all columns involved in the OR
belonging to the same table.
SARG or SARG [or ...]
This IN
statement
column in ( constant1, constant2, ...)
is also treated as an OR
clause, becoming this:
column = constant1 or column = constant2 or ...
Some examples of OR
clauses are as follows:
where LastName = 'Smith' or FirstName = 'Fred'where (Name like '%bearing%' and ListPrice > $25) or ProductSubcategoryID ...
Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.