|
Posted by Erland Sommarskog on 08/16/06 21:14
gherrell (greg.herrell@gmail.com) writes:
> That makes sense. However, I didn't express myself very well.
> I am looking for validation that this approach with a view gives the
> same opportunity for a performance benefit as a parameterized UDF or
> straight stored procedure.
I'm not really sure what you mean, but using a view should not matter
in theory. That is, SELECT from the view or the SELECT from the base
query in the same thing.
But there is a risk: say that a programmer finds the view and thinks
"hey I get the value from X from this view, and value of Y from that
view". When you expand the query, you see that several tables appears
twice, although it had been sufficient with one. But will the optimizer
see that?
In the system I work with, we have very few views. There is one corner
of the database that I am not inolved with where they choose to use it,
and I believe makes sense there. Myself, I've only used views a few
times when I have rearranged tables, and kept the old definition as view
for compatibility.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|