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 2005 Forums
 Transact-SQL (2005)
 query tuning

Author  Topic 

cognos79
Posting Yak Master

241 Posts

Posted - 2010-09-29 : 23:00:35
I do have a table with over 600k records and have a non-clustered index on "course" column.

when I do something like
select * from table where course is not null
sql server is doing a index scan and taking way long time to execute. Is there a way I can speed up the query execution?

Sachin.Nand

2937 Posts

Posted - 2010-09-29 : 23:55:51
What are columns in "*"?

PBUH

Go to Top of Page

cognos79
Posting Yak Master

241 Posts

Posted - 2010-09-30 : 09:06:05
I am just selecting two columns in select list.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-09-30 : 09:12:32
how selective is that query? (what precentage of rows returned from the whole).

If it's a large precentage An index scan could well be the most efficient way to do it.

However, it will then have to perform a lookup because you are SELECing *

If it's only two columns then you could try INCLUDING the column(s) in your index.

Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -