The information in this article applies to:
SUMMARYTo increase performance when selecting from a view, do not evaluate aggregate functions in the view, if possible. MORE INFORMATIONTo illustrate this idea, assume the following table and view definitions:
If the statement "SELECT * FROM MyView" is executed, SQL Server will
need to sum all the values in the table for col3 that match the WHERE
condition of the view. However, if the aggregate column in the view
("SUM(col3)") is not included in a SELECT statement, the values in
col3 will not be summed. Therefore, if a large number of rows meet the
condition(s) of the WHERE clause in the view, a considerable
performance gain can be realized by not selecting that column unless
it is needed.
The following queries are examples where the summing of col3 from the view will not be performed:
Additional query words:
Keywords : kbprg kbSQL |
Last Reviewed: July 12, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |