title: Index does Not affect query performance in indexed views
body: <p>I want to examine query performance on indexed views.</p>
  
  <p>I create a view based on <code>Product</code> table in <code>Northwind</code> database with all columns.After create view I add a clustered index on the view (Because I couldn't create a non-clustered index without int).</p>
  
  <p>Now before I add a non-clustered index I check this query execution plan and statistics :</p>
  
  <pre><code>SELECT [ProductName]
    ,[QuantityPerUnit]
    ,[UnitPrice]
    ,[UnitsInStock]
    ,[UnitsOnOrder]
    ,[ReorderLevel]
    ,[Discontinued]
  FROM [Northwind].[dbo].[test_IndexedView]
  WHERE UnitPrice = 21.35
  </code></pre>
  
  <p>and then I create an index :</p>
  
  <pre><code>CREATE NONCLUSTERED INDEX [idx_Unitp] ON [dbo].[test_IndexedView] 
  (
  [UnitPrice] 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]
  GO
  </code></pre>
  
  <p>and again I execute that query but nothing change.Not in exection plan not in statistics.</p>
  
  <p>where is the problem? How I can increase performance with indexed view?</p>
  
  <hr>
  
  <p><strong>Edit 1)</strong>
  I create a view :</p>
  
  <pre><code>CREATE VIEW [dbo].[indexView]
  WITH SCHEMABINDING 
  AS
      SELECT     ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, Discontinued, ReorderLevel
      FROM         dbo.Products
  GO
  </code></pre>
  
  <p>and then when I want to create a 'nonclustered index` on it Like this:</p>
  
  <pre><code>CREATE NONCLUSTERED INDEX [idx_Unitp] ON [dbo].[IndexView] 
  (
      [UnitPrice] ASC
  )
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Msg 1940, Level 16, State 1, Line 1<br>
    Cannot create index on view 'dbo.IndexView'. It does not have a unique clustered index.</p>
  </blockquote>
  
  <p>So I forced to create a clustered index.</p>
  
  <p>both of execution plan before and after index is <code>Index Scan</code></p>
  
  <p>The result of <code>SELECT @@VERSION</code> is :</p>
  
  <blockquote>
    <p>Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (Intel X86)<br>
    Sep 16 2010 20:09:22   Copyright (c) 1988-2008 Microsoft Corporation<br>
    Enterprise Edition on Windows NT 6.1  (Build 7600: )</p>
  </blockquote>