NeverDie:
Which CLUSTERED INDEX would be better:
1. CountryID, ProvinceID, StreetID
or
2. StreetID, ProvinceID, CountryID
Depends on the queries that you have. The optimal order for columns in an index is determined by the queries you have on that table. Nothing else.
If all your queries are equality queries on all three columns, then they're both fine and the queries will execute the same with either one. If you have queries on CountryID alone, or CountryId and ProvinceID then the first one is more useful. If you have lots of queries on StreetID alone or StreetID and ProvinceID then the second one is more useful.
Oh, and the order in which you specify the conditions in the where clause is absolutely irrelivent. The optimiser can and will reorder conditions for to get an optimal execution plan
Gail Shaw -
SQL In the WildSQL Server MVP
--
Chaos, panic and disorder. My job here is done!