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)
 index match

Author  Topic 

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-11-20 : 01:12:35
Index is created in 2 tables for matching column ...
qry is ..

select a.c1 , b.c1 from a,b
where a.c1 = b.c1

Here a of c1 and b of c1 are indexed ... how will the index act in this case ???
first the data will get match and index will be applied...
only in search with value only index applied ?? like below..

select a.c1 , b.c1 from a,b
where a.c1 = b.c1
and a.c1 = '235'

execution plan shows index seek...


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-20 : 01:16:40
it searches using the index for the join. thats why you get index seek. didnt understand what you mean by index applied. did you mean using index?
Go to Top of Page

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-11-20 : 01:22:59
in this case i can understand how seek happens ...
select a.c1 , b.c1 from a,b
where a.c1 = b.c1
and a.c1 = '235'
Based on that value index apply can happen no issue ..
but in below case
select a.c1 , b.c1 from a,b
where a.c1 = b.c1

both joined columns are indexed , definitely it matches data , but will they apply index search and how ???
Normally in microsoft document they use to say index column match should in first of where clause ...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-20 : 01:55:56
what index have you applied? clustered or non clustered?
Go to Top of Page

niranjankumark
Posting Yak Master

164 Posts

Posted - 2008-11-20 : 01:58:54
BOTH ARE HAVING CLUSTER INDEX... IF U SEE EXEUTION PLAN INDEX SEEK IS NOT HAPPENING ...
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2008-11-20 : 06:38:11
Why do you care? Is it returning wrong results? Is it running too slowly? What's the issue here?
Go to Top of Page
   

- Advertisement -