Index Tuning

Use sp_BlitzIndex to find problem queries and stats on existing indexes. Info Here

Includes vs Index Column


Includes do not sort. Examples

This index

1
2
Create Index IX_DisplayName_Include_Location
  ON dbo.Users(DisplayName) Include (Location);

Is equivalent to this query

1
2
3
Select Id, DisplayName, Location
  FROM dbo.Users
  ORDER By DisplayName;

This index

1
2
Create Index IX_DisplayName_Location
  ON dbo.Users(DisplayName, Location);

Is equivalent to this query

1
2
3
Select Id, DisplayName, Location
  FROM dbo.Users
  ORDER By DisplayName, Location;

Enable Statistics when testing

Always enable IO Statistics and CPU Statistics when testing to see the impact your changes are making.

1
2
SET STATISTICS IO ON
SET STATISTICS TIME ON 

Use Statistics Parser to parse the output for better formatting if creating reports.