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 78422D1C90E for ; Wed, 30 Jul 2003 02:27:31 +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 14338-09 for ; Tue, 29 Jul 2003 23:26:34 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id A9C67D1C4CB for ; Tue, 29 Jul 2003 23:27:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id BC6B91024D; Tue, 29 Jul 2003 22:20:20 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 1449710248; Tue, 29 Jul 2003 22:20:18 -0400 (EDT) Subject: Re: function returning setof performance question From: Rod Taylor To: Mark Bronnimann Cc: pgsql-sql@postgresql.org In-Reply-To: <20030730020859.GA1795@spiff.astoria.bogus> References: <20030730020859.GA1795@spiff.astoria.bogus> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-wXIudNigNvDGi5HPPEaG" Message-Id: <1059532098.54325.23.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 29 Jul 2003 22:28:19 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/441 X-Sequence-Number: 14555 --=-wXIudNigNvDGi5HPPEaG Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > The performance hit is tiny, we're talking less than 1/2 a second,=20 > but when I've done this sort of thing in Oracle I've seen a performance= =20 > increase, not a decrease.=20 Thats just plain strange (never tried on Oracle). Why in the world would adding the overhead of a function call (with no other changes) increase performance? The function has additional overhead in the form of the plpgsql interpreter. You may find a c function will give close to identical performance as with the standard view so long as the query is the same. One thing to keep in mind is that the view can be rearranged to give a better query overall. The exact work completed for the view may be different when called from within a different SQL statement. Most functions -- some SQL language based functions are strange this way -- cannot do this --=-wXIudNigNvDGi5HPPEaG Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Jy1C6DETLow6vwwRAjEJAJ446f+fjBCyFkVZtobtqqMx3Dai+ACfVjbo 9tdR9XTAfLtilquPPr9tok0= =nfdL -----END PGP SIGNATURE----- --=-wXIudNigNvDGi5HPPEaG--