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
 SQL Server Administration (2005)
 Index Execution

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2008-06-16 : 04:34:00
Hi ,
Iam just checking whether which index is called while executing the below query:

set showplan_text on

Select * from tester where age>25



Table Structure[Tester]:
Sno int,name varchar(25),age int

Clustered index on sno [index name:cid_test ]
non clustered index on age [index name:ind_te_age]



index called is cid_test
My doubt is actually is should call ind_te_age


pootle_flump

1064 Posts

Posted - 2008-06-16 : 07:00:49
Not if you use "SELECT *". You will get a clustered index scan. The only way you will use an index on age for that query is if:
The non clustered index covers the query
Age is the first column in the clustered index key
The query returns around 3% or less of the table
Go to Top of Page
   

- Advertisement -