Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does the order of columns matter?
Message
 
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01639951
Message ID:
01640080
Views:
48
>>https://technet.microsoft.com/en-us/library/jj835095%28v=sql.110%29.aspx?f=255&MSPPError=-2147217396
>>
>>Somewhere in the middle of the article you can find the following:
>>
>>Consider using filtered indexes on columns that have well-defined subsets, for example sparse columns, columns with mostly NULL values, columns with categories of values, and columns with distinct ranges of values. A well-designed filtered index can improve query performance, reduce index maintenance costs, and reduce storage costs.
>>Consider the order of the columns if the index will contain multiple columns. The column that is used in the WHERE clause in an equal to (=), greater than , less than , or BETWEEN search condition, or participates in a join, should be placed first. Additional columns should be ordered based on their level of distinctness, that is, from the most distinct to the least distinct.
>>For example, if the index is defined as LastName, FirstName the index will be useful when the search criterion is WHERE LastName = 'Smith' or WHERE LastName = Smith AND FirstName LIKE 'J%'. However, the query optimizer would not use the index for a query that searched only on FirstName (WHERE FirstName = 'Jane').
>
>If I read that right then my supposition was correct ? :
>"Additional columns should be ordered based on their level of distinctness, that is, from the most distinct to the least distinct."

In other words, from the most selective (e.g. column with many unique values) to the less selective (column with less values). This is how I understand it and this is what I said.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform