If I have tables joined on two columns in each table, what is the advantage of using a compostite index as opposed to indexing each column individually?
There are so many factors invovled, it is nearly impossible to give an answer to the question.
Some of the factors include:
1) What is selection criteria in the where clause, if any?
2) How is the data distributed in the tables?
3) Are any of the indexes clustered?
4) Which version of SQL Server are you running?
The best way to decide is to test with various index configurations. Use the Query Analyzer to display the Estimated Query Plan. You'l be able to see which indexes are used, if any. Terry L. Broadbent - DBA
Computing Links:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.