I have a table with two very important fields:
id INT identity(1,1) PRIMARY KEY identifiersortcode VARCHAR(900)
My application always sorts and views search results in the user interface based on identifiersortcode , but all table joins (and they are legionnaires) are in the id field. (Also: yes, the sort code is really so long. There is a strong reason for BL.)
In addition, due to the use of O / RM, most SELECT statements will pull almost every column.
Currently, the clustered index is on id , but I wonder if the TOP / ORDER BY part of most queries will make identifiersortcode more attractive option as a clustered key, even considering that all table joins continue.
Insertions into the table and changes to identifiersortcode are so limited that changing my clustered index would be a problem for insert / update operations.
Trying to make the index of a non-clustered sort index an index of coverage (using INCLUDE ) is not a good option. There are several large columns, and some of them have a lot of refresh activity.
source share