Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Clustered Index on a Heap question...

Author  Topic 

Jusvistin
Yak Posting Veteran

81 Posts

Posted - 2003-08-16 : 16:59:07
Let's say I've got a 26,000 row table of people - each row contains the person's last name, and there are 1,000 rows for last names beginning with a,b,c,d etc equally distributed.

Let's say I've got a non-clustered index on last name, the table does not have a clustered index, or is clustered on something other than last name.

Now, I run a query and ask for all records with last names beginning with A - N.

Does anyone know SQL Server determines whether it would be more efficient to use the index to locate the records, or just do a table scan ?


Just wondering,
Kevin

SamC
White Water Yakist

3467 Posts

Posted - 2003-08-16 : 17:44:38
My experience looking at execution plans is that the compiler changes it's mind daily based on table statistics .

Why don't you look at the execution plan in query analyzer and let us know what it is using?

Sam
Go to Top of Page

Jusvistin
Yak Posting Veteran

81 Posts

Posted - 2003-08-16 : 17:47:47
Well,

At this point it's only theoretical, no data to report upon. I may generate the test data later to test it. I'm studying a book by Rob Vieira, and the question just popped into my head.


Kevin
Go to Top of Page
   

- Advertisement -