Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Index Details SQL

Tags:

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.

like image 619
Matt P Avatar asked Sep 14 '12 12:09

Matt P


People also ask

How do I find missing index details in SQL Server?

To determine which missing index groups a particular missing index is part of, you can query the sys. dm_db_missing_index_groups dynamic management view by equijoining it with sys. dm_db_missing_index_details based on the index_handle column.

How do I get index details in SQL Server?

sp_helpindex is a system stored procedure which lists the information of all the indexes on a table or view. This is the easiest method to find the indexes in a table. sp_helpindex returns the name of the index, description of the index and the name of the column on which the index was created.

How do I view indexed data in SQL?

Introduction to SQL Server indexed view To create an indexed view, you use the following steps: First, create a view that uses the WITH SCHEMABINDING option which binds the view to the schema of the underlying tables. Second, create a unique clustered index on the view. This materializes the view.


1 Answers

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]) 
like image 120
Andomar Avatar answered Sep 25 '22 01:09

Andomar