Re: Setup index
From: Wayne Snyder (wsnyder_at_computeredservices.com)
Date: 05/29/04
- Next message: Wayne Snyder: "Re: Profiling Query Parallelism"
- Previous message: Hari: "Re: # of CPU for SQL Server"
- In reply to: ying: "Setup index"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 29 May 2004 08:15:03 -0400
The optimizer tries to find a good way to get your data. Using a
nonclustered index to retrieve data is often the best answer when there is a
very small percentage of the rows being returned. As the number of rows
being returned increases, at some point it becomes faster for the results to
come directly from the clustered index .
What you are seeing is the normally good behaviour of the optimizer.
-- Wayne Snyder, MCDBA, SQL Server MVP Mariner, Charlotte, NC www.mariner-usa.com (Please respond only to the newsgroups.) I support the Professional Association of SQL Server (PASS) and it's community of SQL Server professionals. www.sqlpass.org "ying" <anonymous@discussions.microsoft.com> wrote in message news:146e401c444f2$f3fe7310$a301280a@phx.gbl... > > I create a index on a "date" field on a table. When I use > query: > Select ... > From table > Where date='5/21/2004', in the estimated executation plan, > I can see it use the bookmark lookup which is the "date" > index. > However, if I change the query to: > ....where date between '1/1/2004' and '1/31/2004'. It use > clustered index which is another field. > > Can any one tell me why this happen? I think both queries > should use the "date" index. How I can improve the > performance? > > Thanks.
- Next message: Wayne Snyder: "Re: Profiling Query Parallelism"
- Previous message: Hari: "Re: # of CPU for SQL Server"
- In reply to: ying: "Setup index"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|