Shortcut: Missing index details in SQL Server Management Studio

I've mentioned before that SQL Server Management Studio (SSMS) is a good tool for analyzing queries, as much as for executing them.

In SQL Server 2005, query plans had missing index details added. When a query plan was created, SQL Server recorded that it thought it could have executed the query better, if only you'd provided it with appropriate indexes. But at that point, the suggestions weren't very good, and the tools didn't show them.

In SQL Server 2008, the suggestions got better (eg: we weren't endlessly having suggestions to create non-clustered indexes for every column in the table), and SSMS now showed them clearly.

Here's an example query with an issue:

SQL Server thinks it's doing this work the hard way. Note that it suggests an impact of over 97% on running this query, just because an index is missing.

To find out what it wants, we right-click in the white area of the query plan:

The option of interest is Missing Index Details. When we click that to open it, the following appears:

Overall, the suggestions that this system makes aren't bad. They are far from perfect but if you don't know much about SQL Server indexing, these suggestions might make a good start. Just don't blindly follow large numbers of them. Someone with strong SQL Server skills can often come up with better suggestions than those currently offered by the tools.

Also, make sure you rename the index. I have come across indexes at customer sites where the index name is [<Name of Missing Index, sysname,>]. I wish I was joking.

Learn about indexing

Want to learn more about indexes? Take our online on-demand course now:  https://training.sqldownunder.com/p/sql-server-indexing-for-developers

 

Leave a Reply

Your email address will not be published.