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

SARG or SARG [or ...]

with all columns involved in the OR belonging to the same table.

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:

image

An OR clause is a disjunction; all rows matching either of the two criteria appear in the ...

Get Microsoft® SQL Server 2008 R2 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.