Missing Index Details SQL

Matt P picture Matt P · Sep 14, 2012 · Viewed 29.4k times · Source

I am tuning my SQL server and when I show my execution plan for one of my queries at the top it reads:

"Missing Index (Impact 99.7782): CREATE NONCLUSTERED INDEX..."

So I looked at the missing index details and it is showing this:

/*
Missing Index Details from ExecutionPlan1.sqlplan
The Query Processor estimates that implementing the following index could improve the query cost by 99.7782%.
*/

/*
USE [phsprod]
GO
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[address] ([userid])

GO
*/

I have only been working with SQL for about a month now and I have never done anything with this as all my tables have been built for me already. Can anyone help explain/give me any ideas on what to do with this? Thanks.

Answer

Andomar picture Andomar · Sep 14, 2012

That means SQL Server is suggesting that your query could run faster with an index. Indexes add overhead and disk storage, so you should ignore this hint unless the query is giving performance problems in production.

To create the index, uncomment the statement after use, replace [<Name of Missing Index, sysname,>] with a real name, and run it:

USE [phsprod]
GO
CREATE NONCLUSTERED INDEX IX_Address_UserId
ON [dbo].[address] ([userid])