|  | Posted by Erland Sommarskog on 04/05/06 00:33 
Danny (djscroggins@verizon.net) writes:> 2. Avoid transformations in the views.  Performance can really suffer by
 > using things like Case statements.  You may think.. Just this one report
 > will use this view and it doesn't need to be fast.  However, a year from
 > now I promise someone will see the name of the view and what it returns
 > and pile more code on top of it.
 
 Yes, that's one thing that make me nervous about views. Some thinks a
 view has a column he needs that, and then he builds a new on that. Problem
 is that when you expand the entire view, some underlying big table may
 appear several times in view, being in fact joined to itself on the primary
 key.
 
 In our shop, we were for a long time without views at all. One project
 added views into one corner of the database, where I think it actuall
 made sense. (I was not involved myself.) I actually added two views to
 the application for our latest version. These views are quite convoluted
 and probably not very effective. But these views are there only for
 compatibility. That is, I reworked some piece of data is stored, but
 there were too many procedures to change right now, so these views
 mimick the old tables
 
 --
 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
 [Back to original message] |