X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 92450D1B508 for ; Mon, 20 Oct 2003 18:58:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 82216-07 for ; Mon, 20 Oct 2003 15:57:44 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 65BD9D1B4E3 for ; Mon, 20 Oct 2003 15:57:42 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.1.5) with ESMTP-TLS id 437376; Mon, 20 Oct 2003 11:56:31 -0700 Message-ID: <3F942F72.6050709@joeconway.com> Date: Mon, 20 Oct 2003 11:54:42 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: josh@agliodbs.com Cc: Richard Huxton , Michael Pohl , pgsql-sql@postgresql.org, "George A.J" Subject: Re: Which is faster SQL or PL/PGSQL References: <200310201849.19668.dev@archonet.com> <3F942558.2000804@joeconway.com> <200310201124.02090.josh@agliodbs.com> In-Reply-To: <200310201124.02090.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/252 X-Sequence-Number: 15652 Josh Berkus wrote: >>Yes, I believe so (well, actually the optimizer). An inlined SQL >>function ends up behaving like a macro that expands at run time and is >>therefore quite fast -- no function call overhead at all. > > ... but only in 7.4. In 7.2 and I think in 7.3 this was not implemented. Yeah, that's what my original post said ;-) > While we're on the topic, anyone know any good ways to speed up EXECUTE > statements in PL/pgSQL functions? Never tried it, but is it possible to use a prepared statement inside a PL/pgSQL function? In any case, you can in other PLs. And with library preloading (starting in 7.4), the first call to other PLs is similar to that of PL/pgSQL. See: http://archives.postgresql.org/pgsql-patches/2003-07/msg00239.php Joe