Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C5E862E0073 for ; Sat, 22 Mar 2008 11:01:59 -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 96958-04 for ; Sat, 22 Mar 2008 11:01:57 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.70]) by postgresql.org (Postfix) with ESMTP id E64202E0078 for ; Sat, 22 Mar 2008 11:01:56 -0300 (ADT) Received: from mac.com (asmtp003-s [10.150.69.66]) by smtpoutm.mac.com (Xserve/smtpout007/MantshX 4.0) with ESMTP id m2ME1t6H022218 for ; Sat, 22 Mar 2008 07:01:55 -0700 (PDT) Received: from alichino.refactor.it (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 m2ME1oEN017277 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Sat, 22 Mar 2008 07:01:54 -0700 (PDT) Message-Id: <6A737ADC-2A11-4A01-8ACE-C439E4297273@mac.com> From: Giorgio Valoti To: pgsql-performance@postgresql.org Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Views and functions returning sets of records Date: Sat, 22 Mar 2008 15:01:50 +0100 X-Mailer: Apple Mail (2.919.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL=0.001 X-Spam-Level: X-Archive-Number: 200803/429 X-Sequence-Number: 29383 Hi all, maybe it=92s a naive question but I was wondering if there is any =20 difference, from a performance point of view, between a view and a =20 function performing the same task, something like: CREATE VIEW foo AS =85; CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$ SELECT * FROM foo WHERE fooid =3D $1; $$ LANGUAGE SQL; Thank you -- Giorgio Valoti