dbTalk Databases Forums  

Question on Indexes...errr, indices...

microsoft.public.sqlserver.programming microsoft.public.sqlserver.programming


Discuss Question on Indexes...errr, indices... in the microsoft.public.sqlserver.programming forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
roy.anderson@gmail.com
 
Posts: n/a

Default Question on Indexes...errr, indices... - 02-16-2005 , 07:59 AM






Hey all,

Lets say I have stored proc "x" and "x" pulls it's data from a certain
table. However, on that table there are 3 indices and each index
contains the field specified in "x"s WHERE clause.

How does SQL Server decide which query to use? IOW, I guess my root
question is, what is the best way to design indices to get maximum
efficiency?


Reply With Quote
  #2  
Old   
Adam Machanic
 
Posts: n/a

Default Re: Question on Indexes...errr, indices... - 02-16-2005 , 08:24 AM






SQL Server looks at a variety of factors, including index statistics, what
columns are present in the index other than the key column (i.e. if the
index "covers" the query), and various other factors. There are lots of
good articles at http://www.sql-server-performance.com on this and related
topics.

--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--


<roy.anderson (AT) gmail (DOT) com> wrote

Quote:
Hey all,

Lets say I have stored proc "x" and "x" pulls it's data from a certain
table. However, on that table there are 3 indices and each index
contains the field specified in "x"s WHERE clause.

How does SQL Server decide which query to use? IOW, I guess my root
question is, what is the best way to design indices to get maximum
efficiency?




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.