Re: View vs. direct Table access

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Darren Ferguson <darren(at)crystalballinc(dot)com>
Cc: Marin Dimitrov <marin(dot)dimitrov(at)sirma(dot)bg>, pgsql-general(at)postgresql(dot)org
Subject: Re: View vs. direct Table access
Date: 2002-03-27 16:03:32
Message-ID: 200203271603.g2RG3Wh27264@saturn.janwieck.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Yahoo(dot)com #

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-03-27 16:12:34 Re: View vs. direct Table access
Previous Message Marin Dimitrov 2002-03-27 15:39:49 grants on functions