Re: Views of views, complexity and speed. - Mailing list pgsql-general

From Jan Wieck
Subject Re: Views of views, complexity and speed.
Date
Msg-id 200202061548.g16Fm4D04458@saturn.janwieck.net
Whole thread Raw
In response to Re: Views of views, complexity and speed.  (bombadil@wanadoo.es)
List pgsql-general
bombadil@wanadoo.es wrote:
> El martes 05 de febrero, Jan Wieck escribió:
> >     The question I have is what do you really compare?  You  said
> >     "looking  in  plain tables instead of other views". Does that
> >     mean your query is faster when you build one big view against
> >     all  the base tables instead of cascaded views, or what? What
> >     is the performance difference if you  instead  of  using  the
> >     cascaded  views  query  all  the  base  tables  in a big join
> >     directly?
>
>  Your comment resumes very well my essential question. I only want to
>  know if there is a reason for thinkink that a cascade of views can be
>  slower than a complex view that includes all tables. Is the planner
>  well tuned for working with this complex cases (cascade of views)?
>
>  Actually I am making experiments with all this stuff. Better idea
>  than sending a lazy question in the list.

    In  principle  the  penalty  for  cascading  views  should be
    negligible, because the resulting queryplan  after  rewriting
    ought  to  be  comparable  to what you would have to write as
    query yourself, if you wouldn't have views at all.  So  after
    some  recursion  in  the  rewriter, the planner and optimizer
    should face the same join problem.

    As long as your not gonna  write  triggers  to  maintain  the
    information  you  want  from  the  views in plain tables, the
    answer  is  that  there   is   no   significant   performance
    difference.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: bombadil@wanadoo.es
Date:
Subject: Problem with a view (not lazy ;)
Next
From: Chris Gamache
Date:
Subject: Re: 7.1.3 : copy from stdin is very slow!