Running the advisor it suggests I should create an index on Path, Value and to include Id.
Path varchar(250)
Value bigint
Id uniqueidentifier
-
When using the index in a query, will it be faster having
Idin the index rather than as an include? -
Will inserts be slower having
Idas an include rather than in the index?
1) Depends on query if it looks like
i.e. – if query involves exact values (not ranges) of Path and Value – then yes, else – no, will be slower because of more thicker non-leaf rows
INCLUDEsection – because no needs to save it on non-leaf pagesAs you noticed:
So, its better include all the rows in index, and the best order of columns will depend on structure/indexes of other table in
JOIN.The index should look like
(Value, Id, Path)or(Value, Path, Id)– depending on mentioned above.