Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 346E79FB50B for ; Fri, 9 Mar 2007 04:34:10 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 12516-02 for ; Fri, 9 Mar 2007 04:34:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 1D6F49FB4F5 for ; Fri, 9 Mar 2007 04:34:07 -0400 (AST) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 28BE273A9A; Fri, 9 Mar 2007 08:34:01 +0000 (GMT) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 03E8927408E; Fri, 9 Mar 2007 08:34:00 +0000 (GMT) Message-ID: <45F11BF8.4080809@archonet.com> Date: Fri, 09 Mar 2007 08:34:00 +0000 From: Richard Huxton User-Agent: IceDove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: "Kashmira Patel (kupatel)" Cc: pgsql-sql@postgresql.org Subject: Re: Creating views References: <18AE59788A3FC640A367E5652E664D8003CA26C6@xmb-sjc-237.amer.cisco.com> In-Reply-To: <18AE59788A3FC640A367E5652E664D8003CA26C6@xmb-sjc-237.amer.cisco.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.205 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200703/97 X-Sequence-Number: 27735 Kashmira Patel (kupatel) wrote: > Hi all, Is it possible to create views that take parameters? > Basically, I have to create some very complex historical reports, and > as of now I am using temporary tables to store intermediate query > results. I calculate values based on the content of these temporary > tables and use them in the final result. I would like to eliminate > the need for temporary tables and use views instead, as the data copy > between the temp tables is taking quite some time. You can write a function (in SQL even) that would basically be a parameterised view. However, views don't "store" anything, so whether you see an improvement in speed will depend on how long it takes to do your calculations. -- Richard Huxton Archonet Ltd