Friday, March 9, 2012

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

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?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@.gmail.com> wrote in message
news:1108562342.303000.70650@.l41g2000cwc.googlegroups.com...
> 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?
>

No comments:

Post a Comment