Databases Reference
In-Depth Information
/*
Missing Index Details from SQLQuery1.sql - The Query Processor estimates that
implementing the following index could improve the query cost by 99.7137%.
*/
/*
USE [AdventureWorks]
GO
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[SalesOrderDetail] ([SalesOrderID], [SalesOrderDetailID])
GO
*/
Listing 4-23.
Create the recommended index, after you provide a name for it, by running the
following statement:
CREATE
NONCLUSTERED
INDEX
IX_SalesOrderID_SalesOrderDetailID
ON
[dbo]
.
[SalesOrderDetail]
(
[SalesOrderID]
,
[SalesOrderDetailID]
)
Listing 4-24.
If you run the query in Listing 4-20 again and look at the execution plan, this time you'll
see an Index Seek operator using the index you've just created, and both the Missing
Index warning and the
MissingIndex
element of the XML plan are gone, as shown in
Figure 4-8.