I\'ve never really understood the difference between these two indexes, can someone please explain what the difference is (performance-wise, how the index structure will look li
In first Index, in Index page only PostalCode is the key column and AddressLine1, AddressLine2, City, StateProvinceID are part of leaf node to avoid key/RID lookup
I will prefer first index when my table will be filtered always on PostalCode and any of this columns AddressLine1, AddressLine2, City, StateProvinceID will be part of select and not filtration
select AddressLine1, AddressLine2, City, StateProvinceID
from Person.Address
Where PostalCode=
In second index, in Index page there will be five key columns PostalCode, AddressLine1, AddressLine2, City, StateProvinceID
I will prefer second index when I have possiblity to filter data like
Where PostalCode = And AddressLine1 =
or
Where PostalCode = And AddressLine2 =
or
Where PostalCode = And AddressLine1 = and AddressLine2 =
and so on..
At any case the first column in index should be part of filtration to utilize the index