title: Unindexed views v/s Queries
body: <p>I'm creating a view which contains subquery as specified witht he following SQL query on SQL Server 2012.</p>
  
  <pre><code>CREATE VIEW [dbo].[VIEW_Detail] WITH SCHEMABINDING
  AS
  SELECT a.ID, a.Name1, a.Name2,
         STUFF
            ((SELECT        CAST(',' AS varchar(max)) + t .Name1
              FROM            dbo.Synonyms AS s 
              INNER JOIN dbo.Details AS t ON s.SynonymTSN = t .TSN
              WHERE        s.oID= a.ID FOR XML PATH('')), 1, 1, '') AS Synonym
  FROM    a.Details
  WHERE   (a.Rank &lt;= 100)
  </code></pre>
  
  <p>Since the definition contains a subquery I'm not able to create an Indexed view. Will it be faster to use a query instead of the view to retrieve data if my tables are indexed.Or will an unindexed view will still perform better than using a query. The view currently contains more than 50,000 rows. What other query optimizations can I use?</p>
  
  <p>PS: I don't care about performance on insert/update</p>