Click here to monitor SSC SQLServerCentral is supported by Red
Gate Software Ltd. Log in  ::  Register  ::  Not logged in
Indexing for ORs  All of the indexing strategy posts I’ve
written in the past have been concerned with predicates combined
with ANDs. That’s only one half of the possibilities though.
There’s the case of predicates combines with ORs, and the
guidelines for indexing that work well with ANDs don’t work with
ORs  When dealing with predicates combined with AND, the
predicates are cumulative, each one operates to further reduce
the resultset.  For this reason, multi-column indexes support
multiple predicates combined with AND operators.  If we look at
a quick example, consider the following.  CREATE TABLE Customers
(   Surname VARCHAR(30) NOT NULL,   FirstName VARCHAR(30),
Title VARCHAR(5),   CustomerType CHAR(1) NOT NULL, CREATE INDEX
idx_Customers_SurnameFirstName ON Customers (Surname,
FirstName);  Again I’m going to be lazy and get SQLDataGenerator
to generate a few rows.  With that two