X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0CCA352812 for ; Tue, 21 Jun 2005 11:45:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22450-01 for ; Tue, 21 Jun 2005 14:45:17 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 9B1E552949 for ; Tue, 21 Jun 2005 11:45:16 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so1297305wra for ; Tue, 21 Jun 2005 07:45:21 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GJc0byNVMwYUptgwu7joXnzwqTYDBwPD6YgC3mZ2o3t3+GAXl8SSjLVC633Trh1pSkg9h5szRKLzqYdpdJeMw0nBAkgK8ldhsiQskhParXitdY0YRw/YLCf6kDyKDk5+XWqrAVGrOpStykcDdxzo/RkSzexfvQ/WzvOAqEqBnuQ= Received: by 10.54.141.13 with SMTP id o13mr1672627wrd; Tue, 21 Jun 2005 07:45:21 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Tue, 21 Jun 2005 07:45:21 -0700 (PDT) Message-ID: Date: Tue, 21 Jun 2005 09:45:21 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Amit V Shah Subject: Re: Do Views execute underlying query everytime ?? Cc: "pgsql-performance@postgresql.org" In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.096 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/380 X-Sequence-Number: 13017 On 6/21/05, Amit V Shah wrote: > Hi all, ... > I am thinking of having a solution where I create views for each screen, > which are just read only. >=20 > 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 .. >=20 > 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. --=20 Matthew Nuzum www.bearfruit.org