Why does Sql Server recommends creating an index when it already exist?

Posted by Pierre-Alain Vigeant on Stack Overflow See other posts from Stack Overflow or by Pierre-Alain Vigeant
Published on 2010-03-15T18:31:57Z Indexed on 2010/03/15 20:09 UTC
Read the original article Hit count: 349

I ran a very basic query against one of our table and I noticed that the execution plan query processor is recommending that we create an index on a column

The query is

SELECT SUM(DATALENGTH(Data))
FROM Item
WHERE Namespace = 'http://some_url/some_namespace/'

After running, I get the following message

// The Query Processor estimates that implementing the following index could improve the query cost by 96.7211%.
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[Item] ([Namespace])

My problem is that I already have such index on that column:

CREATE NONCLUSTERED INDEX [IX_ItemNamespace] ON [dbo].[Item] 
(
    [Namespace] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

Why is Sql Server recommending me to create such index when it already exist?

© Stack Overflow or respective owner

Related posts about sql-server-2008

Related posts about query-analyzer