X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9E112D1C9EF for ; Wed, 30 Jul 2003 02:08:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 19040-02 for ; Tue, 29 Jul 2003 23:08:01 -0300 (ADT) Received: from spiff.astoria.bogus (dsl027-144-149.nyc1.dsl.speakeasy.net [216.27.144.149]) by svr1.postgresql.org (Postfix) with ESMTP id 88FB4D1C9ED for ; Tue, 29 Jul 2003 23:08:55 -0300 (ADT) Received: from spiff.astoria.bogus (localhost.localdomain [127.0.0.1]) by spiff.astoria.bogus (8.12.8/8.12.8) with ESMTP id h6U290TC001878 for ; Tue, 29 Jul 2003 22:09:00 -0400 Received: (from meb@localhost) by spiff.astoria.bogus (8.12.8/8.12.8/Submit) id h6U28xwR001876 for pgsql-sql@postgresql.org; Tue, 29 Jul 2003 22:08:59 -0400 Date: Tue, 29 Jul 2003 22:08:59 -0400 From: Mark Bronnimann To: pgsql-sql@postgresql.org Subject: function returning setof performance question Message-ID: <20030730020859.GA1795@spiff.astoria.bogus> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/439 X-Sequence-Number: 14553 I have a question regarding the performance of a function returning a set of a view as opposed to just selecting the view with the same where clause. Please, if this should go to the performance list instead, let me know. I'm just wondering about this from the sql end of things. Here's the environment: I'm working from PHP, calling on the query. I have a view that joins 12 tables and orders the results. From PHP, I do a select on that view with a where clause. I created a function that queries the view with the where clause included in the function. The function is returning a setof that view taking one variable for the where clause (there are several other static wheres in there). I have found that querying the view with the where clause is giving me quicker results than if I call the function. The performance hit is tiny, we're talking less than 1/2 a second, but when I've done this sort of thing in Oracle I've seen a performance increase, not a decrease. Any ideas? Thanks folks... I'm new to the list. -- Mark Bronnimann meb@speakeasy.net -- Let's organize this thing and take all the fun out of it. --