Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 528502E0038 for ; Sun, 23 Mar 2008 06:37:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 14740-04 for ; Sun, 23 Mar 2008 06:37:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.65]) by postgresql.org (Postfix) with ESMTP id 605922E002D for ; Sun, 23 Mar 2008 06:37:26 -0300 (ADT) Received: from mac.com (asmtp003-s [10.150.69.66]) by smtpoutm.mac.com (Xserve/smtpout002/MantshX 4.0) with ESMTP id m2N9bOmK020354; Sun, 23 Mar 2008 02:37:24 -0700 (PDT) Received: from [192.168.1.54] (88-149-177-167.static.ngi.it [88.149.177.167]) (authenticated bits=0) by mac.com (Xserve/asmtp003/MantshX 4.0) with ESMTP id m2N9bLFF013381 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 23 Mar 2008 02:37:23 -0700 (PDT) In-Reply-To: <20080322165551.GA19460@KanotixBox> References: <6A737ADC-2A11-4A01-8ACE-C439E4297273@mac.com> <29705.1206203639@sss.pgh.pa.us> <20080322165551.GA19460@KanotixBox> Mime-Version: 1.0 (Apple Message framework v753) Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: quoted-printable From: Giorgio Valoti Subject: Re: Views and functions returning sets of records Date: Sun, 23 Mar 2008 10:37:12 +0100 To: Andreas Kretschmer X-Mailer: Apple Mail (2.753) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL=0.000 X-Spam-Level: X-Archive-Number: 200803/433 X-Sequence-Number: 29387 On 22/mar/08, at 17:55, Andreas Kretschmer wrote: > Tom Lane schrieb: > >> Giorgio Valoti writes: >>> maybe it=92s a naive question but I was wondering if there is any >>> difference, from a performance point of view, between a view and a >>> function performing the same task, >> >> Yes. Usually the view will win. > > *smile* :-( I was thinking about using using functions as the main way to =20 interact with the database from an external application. The =20 (supposed) rationale was to simplify the application code: you only =20 have to worry about in and out function parameters. Are there any way to pass some hints to the planner? For example, =20 could the IMMUTABLE/STABLE/VOLATILE modifiers be of some help? Thank you -- Giorgio Valoti