You are here: Re: Views vs Stored Procedures, whats the difference? « MsSQL Server « IT news, forums, messages
Re: Views vs Stored Procedures, whats the difference?

Posted by Doug on 02/06/06 07:05

imagine if you will 5 tables. 3 of them are over a billion rows.

you want to provide a primary key, and pull the detail data out of the
children.

For absolute, positive sure, in sql 2000, if you use a view, the engine
will do this ugly huge join hash table thing on the entire thing, THEN
look for your data.

Take the exact same code, use sense as to teh data lays out, and you
can cut your response times from 20 seconds to sub second where it
should be.
Could I have "optimized" the view wiht hints? Nope. BTDT, didn't work.
The point is the engine is trying to kind of guess blindly how the data
really works, where a good analyst can KNOW how to get the data works.
Something to think about. Doug has written sprocs that broke a view
into pieces that made the whole thing significantly faster then a giant
select statement.
Btw, the compiling of a sproc or any sql statement is trivial in the
grand scheme of data access of large systems.

sql embedded in code is really bad. celko is just barely past that
stage, as he thinks sprocs are limited to replacing embedded sql, and
views are a better solution.
Not.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация