Re: View vs. direct Table access - Mailing list pgsql-general

From Jan Wieck
Subject Re: View vs. direct Table access
Date
Msg-id 200203271603.g2RG3Wh27264@saturn.janwieck.net
Whole thread Raw
In response to Re: View vs. direct Table access  (Darren Ferguson <darren@crystalballinc.com>)
List pgsql-general
Darren Ferguson wrote:
> I am not to sure about Postgres. I just quoted the SQL standard on views.
>
> Although judging from the ones i use and there relative slow speed i do
> not think Postgres caches them in any way
>
> Please Correct me if i am wrong

    The  SQL  standard  describes  the visible behaviour, not the
    implementation.  PostgreSQL doesn't cache them any  different
    from  regular  table  scans  (in  the buffer cache). Nor does
    PostgreSQL  materialize  the  entire  view  when  you  do   a
    qualified SELECT on it.

    The performance of the view should be exactly the same as the
    SELECT statement you  defined  for  it  with  the  additional
    qualifications  you're  using when selecting from the view. I
    think you should use EXPLAIN a  little  to  figure  out  what
    exactly happens when you select from the view and then try to
    optimize the view definition and  the  indexes  on  the  base
    tables a little.


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: "Marin Dimitrov"
Date:
Subject: grants on functions
Next
From: Tom Lane
Date:
Subject: Re: View vs. direct Table access