I have a table [Documents] with the following fields Name (string) Status (string) DateCreated [datetime]
This table is around 1 million records. All three of these columns have an index (a single index for each one)
When I run this query:
select top 50 * from [Documents] where
(Name = 'None' OR Name is null OR Name = '') AND Status = 'New';
Execution is really fast (300 ms.)
If I run the same query but with the order by statement its really slow (3000 ms)
select top 50 * from [Documents] where
(Name = 'None' OR Name is null OR Name = '') AND Status = 'New'
order by DateCreated;
I understand that its searching in another index (DateCreated), but should it really be that much slower? If so, why? Anything I can do to speed this query up (a composite index)?
Thanks
BTW: All Indexes including DateCreated have really slow fragmentation, in fact I ran a Reorganize and it didn't change a thing.
