title: Performance of unused fields in an SQL View
body: <p>I'm using MS SQL Server.</p>
  
  <p>When I define the database schema I define a (non-materialized) view, which includes many fields, for example as follows (where "Topic" is the name of a table, and the view is a self-join on the Topic table):</p>
  
  <pre><code>CREATE VIEW View_Topic_Ancestor AS
  SELECT
      Subordinate.Id AS Subordinate_Id,
      Subordinate.Folder_Id AS Subordinate_Folder_Id,
      Subordinate.topicTitle AS Subordinate_topicTitle,
      Subordinate.topicXhtml AS Subordinate_topicXhtml,
      Subordinate.crossLinked AS Subordinate_crossLinked,
      Superior.Id AS Superior_Id,
      Superior.topicTitle AS Superior_topicTitle,
      Superior.topicXhtml AS Superior_topicXhtml,
      Superior.crossLinked AS Superior_crossLinked
  FROM Topic AS Subordinate LEFT OUTER JOIN Topic AS Superior
  ON Superior.Folder_Id = Subordinate.Folder_Id
  AND 
  Superior.LeftValue = (SELECT MAX(Ancestor.LeftValue)
      FROM Topic AS Ancestor
      WHERE Subordinate.LeftValue &gt; Ancestor.LeftValue
      AND Subordinate.LeftValue &lt; Ancestor.RightValue
      AND Subordinate.Folder_Id = Ancestor.Folder_Id)
  </code></pre>
  
  <p>Later (at run-time) I use this view in a select statement, like this:</p>
  
  <pre><code>SELECT
      T.Id AS Shared_Id,
      V.Superior_Id,
      V.Superior_topicTitle,
      V.Subordinate_Id,
      V.Subordinate_Folder_Id,
      V.Subordinate_topicXhtml
  FROM Topic AS T, View_Topic_Ancestor AS V
  WHERE Folder_Id='e2eb2b68-738d-49ad-9787-a1e655b7973f'
  AND T.crossLinked = V.Subordinate_Id
  </code></pre>
  
  <p>This SELECT statement doesn't reference (doesn't select) many of the fields which are in the view: for example, it selects the Subordinate_topicXhtml field but it doesn't select the Superior_topicXhtml field.</p>
  
  <p>My questions are:</p>
  
  <p>1) Do the fields which are defined in the view, but which are not referenced in the run-time selection from the view, have much effect on performance? Assume if you will that the Superior_topicXhtml field contains a lot of data (is a very long string).</p>
  
  <p>2) How can I verify the answer to this myself? Is testing (measuring ellapsed time with a stop-watch) the only way, or is it possible to obtain an answer based on theory? I am using "Microsoft Server SQL Management Studio" for Microsoft SQL Server 2008, with SQL Express. I see how to obtain (but haven't learned how to interpret) the "estimated execution plan" for this query, but this shows only what indexes and loops are happening, not whether data is being retrieved from unreferenced fields.</p>