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
 General SQL Server Forums
 New to SQL Server Programming
 What index is used?

Author  Topic 

cnicola
Starting Member

2 Posts

Posted - 2006-01-08 : 14:31:36
Hi everyone,

I work with an ERP software that uses a SQL db as the backend so I do not know that much about SQL and therefore I want to appologize in advance if my question is too dumb
When reading a table I can specify in my software what index to be used. However the commands are translated into a SQL Order By command and, if I understand correctly, SQL decides whether to use that key or another based on statistics.
So I need to know how can I tell what exact index SQL eventually decided to use when a certain process is run. I was playing around with SQL 2005 Profiler but the amount of info I get is overwhelming so any suggestions would be very appreciated.

Regards,
Cristi Nicola

Kristen
Test

22859 Posts

Posted - 2006-01-09 : 03:33:25
You can run a query in Query Analyser and see what the "Query Plan" is - that will show which indexes, whether the index is used "seek" or "scan", or whether no indexes is used and you then get a "table scan", and so on.

(Not sure what the equivalent is in SQL 2005, maybe this what you have already seen - yes there is a lot of data and it takes a while to get used to what it all means!)

Kristen
Go to Top of Page
   

- Advertisement -