all groups > sql server programming > september 2006 >
You're in the

sql server programming

group:

Is is normal behaviour to see a table scan?


Is is normal behaviour to see a table scan? mchi55 NO[at]SPAM hotmail.com
9/21/2006 11:34:21 PM
sql server programming:
I have a table with 220000 rows.

There is a column called status_id. I have a nonclustered index on
statusid.

if I do a

select from table
where status_id = 161

I get a table scan with the non clusteredindex.
There are about 16000 records with a status_id of 161. This there no
way to avoid the table scan since there are so many records? Why is
it not using the index?
select *
where status_id = 161 also takes like 2 minutes to run.

If I place a clustered index on status_id...the query returns in a
split second and uses a clustered index seek.
For production purposes...I can't place the clustered index on
status_id.

What can I do?

Also...the table has about 200 rows...completely unnormalized and a
mess.
Re: Is is normal behaviour to see a table scan? Tibor Karaszi
9/22/2006 12:00:00 AM
Already replied to your other post...

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


[quoted text, click to view]
AddThis Social Bookmark Button