On Wed, 11 Aug 2004, Paolo Vernazza wrote:

>Hi,
>I would like to know if using views instead of queries has some
>performance advantages.
>If I must perform many times the same query (a select with a complex
>where clause), is it better to have a precompiled query or to create a
>view?


Views are not so much of an optimization, more of an abstraction of
underlying data. You use views to hide the structure of underlying data or
filter.  Such data may be spread across several tables using a join, but
presented with a single view.

AFAIK, views are compiled into their query definitions when executing a
statement, so once the compilation is done, performance should be
identical to their raw query form.

If you precompile the views, then you have all the benefit of the view
without the overhead of the extra compilation required.

In short, create a view if you have a common filter on some data. If
performance is a factor, precompile the view.


>
>Thanks
>
>Paolo
>

-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

Reply via email to