Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
webguru22
Starting Member
11 Posts |
Posted - 2000-12-28 : 14:33:40
|
| Hi SQL guru dudes,If I have a view called vw_selectSomeStuff, and the underlying SQL is "SELECT blah blah from some tables INNER JOIN this to that"And my stored procedure uses SELECT * FROM vw_selectSomeStuff, am I losing performance over a SP that just contains "SELECT blah blah from some tables INNER JOIN this to that"?Does SQL Server still store an execution plan for the first SP above? In general is there any reason NOT to refer to views in stored procedures? Any advice appreciated. Thanks.Edited by - webguru22 on 12/28/2000 14:34:36 |
|
|
Apollois
Starting Member
49 Posts |
Posted - 2002-11-10 : 17:35:59
|
quote: There is usually very little performance difference between a straight select and a view. Think of a view as a preparsed select. On the initial select the view may be a little quicker due to it already being parsed, but on subsequent execution the straight select may be quicker due to it being cached.
I have been researching views lately, and found many good references in this forum. However, I just found the following on the MSFT web site that suggests that views DO improve performance:=========================================================Query plan generation A query plan is an internal strategy by which a database server tries to create result sets quickly. A database server can establish a query plan for a view as soon as the view is saved. For a query, however, a database server cannot establish a query plan until the query is actually run — that is, until the user explicitly demands the result set.REF: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vdtsql/dvconcomparisonofqueriesviews.asp==============================================================Best Regards,Jim |
 |
|
|
|
|
|