performance - SQL Server: Will the engine execute things from a view that are not needed? -


If I have a view that generates multiple columns:

  see Dbo.foo AS SELECT id, SUM (SELECT [...]) AS C1, STDEV (SELECT [...]) ASC2, AVG (active [...]) ASC [ ...]) AS-C4, max (SELECT [...]) AS-C5, SUM (SELECT [...]) ASC6, [...] COUNT (SELECT [...]) AS  

from CN, ID from table group but I only stop asking for one of those calculated values:

  SELECT id, c382 Foo WHERE id = 42  

Or SQL Server will calculate all column values, only to ignore them?

In my experience, the answer seems to be "yes" a query:

  SELECT id, c382 Foo WHERE id = 42  

I think it should be slow. If I break the intangible, I want to repeat the code:

  ID from SELECT id, c382 FROM (SELECT id, MAX (SELECT [...]) ASC382 by table group ) As the MiniView WHERE id = 42  

query runs better.

Or perhaps it is in more real world that it starts to separate:

  SELECT bar *, Foo.384 FROM times INNER foo ON Join now. Bing = foo.id where times (2000) Crazy? 

This usually works in SQL Server 2000. It is also largely fixed in SQL Server 2005 and later.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -