pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Nuzum <mattnuzum@gmail.com>
To: Amit V Shah <ashah@tagaudit.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Do Views execute underlying query everytime ??
Date: Tue, 21 Jun 2005 09:45:21 -0500
Message-ID: <f3c0b4080506210745e9a9bb0@mail.gmail.com> (raw)
In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com>
References: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com>

On 6/21/05, Amit V Shah <ashah@tagaudit.com> wrote:
> Hi all,
...
> I am thinking of having a solution where I create views for each screen,
> which are just read only.
> 
> However, I donot know if the query that creates the view is executed
> everytime I select something from the view. Because if that is the case,
> then I think my queries will again be slow. But if that is the way views
> work, then what would be the point in creating them ..
> 
> Any suggestions, helps --

They do get executed every time. I have a similar issue, but my data
does not change very frequently, so instead of using a view, I create
lookup tables to hold the data. So once a day I do something like
this:
drop lookup_table_1;
create table lookup_table_1 as SELECT ...;

In my case, rows are not deleted or updated, so I don't actually do a
"drop table..." I merely add new records to the existing table, but if
your data changes, the drop table technique can be faster than doing a
delete or update.

-- 
Matthew Nuzum
www.bearfruit.org



view thread (9+ messages)  latest in thread

Message-ID: <f3c0b4080506210745e9a9bb0@mail.gmail.com>
Permalink:  ../f3c0b4080506210745e9a9bb0@mail.gmail.com/
Also on:    postgresql.org/message-id/f3c0b4080506210745e9a9bb0@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mattnuzum@gmail.com, ashah@tagaudit.com
  Subject: Re: Do Views execute underlying query everytime ??
  In-Reply-To: <f3c0b4080506210745e9a9bb0@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox