Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id D26652E005A for ; Wed, 16 Apr 2008 12:14:31 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 40161-03 for ; Wed, 16 Apr 2008 12:14:28 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by developer.postgresql.org (Postfix) with ESMTP id 0313A2E0057 for ; Wed, 16 Apr 2008 12:14:27 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlcFAB60BUjO+Igp/2dsb2JhbACBYGQ0rCQ X-IronPort-AV: E=Sophos;i="4.25,664,1199682000"; d="scan'208,217";a="18653573" Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 16 Apr 2008 11:14:26 -0400 Received: from [206.248.136.41] ([206.248.136.41]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id WTE43026; Wed, 16 Apr 2008 11:14:26 -0400 Message-ID: <480617D2.7070407@mark.mielke.cc> Date: Wed, 16 Apr 2008 11:14:26 -0400 From: Mark Mielke User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: "Gavin M. Roy" CC: pgsql-performance@postgresql.org Subject: Re: SQL Function Slowness, 8.3.0 References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------040406060805030807020007" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/202 X-Sequence-Number: 29695 This is a multi-part message in MIME format. --------------040406060805030807020007 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Are you going to post the function? :-) My PL/PGSQL functions are running fine in 8.3.x. Cheers, mark Gavin M. Roy wrote: > In 8.3.0, I'm seeing some oddities with SQL functions which I thought > were immune to the planner data restrictions of plpgsql functions and > the sort. Basically I have a query which executes in 5ms but when > wrapped in a SQL function, takes 500ms. I've checked all the types > passed in to make sure they match so there is no type conversions > taking place in execution. > > I'm curious about the validity of my expectation that functions > created with SQL as the language should be as fast as the straight SQL > counterpart. I've previously not run into such an order of magnitude > difference in using SQL functions. Is this a change of behavior in > 8.3 from 8.2? Without specific examples, are there any > recommendations on how to speed up these functions? > > Thanks, > > Gavin > -- Mark Mielke --------------040406060805030807020007 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Are you going to post the function? :-)

My PL/PGSQL functions are running fine in 8.3.x.

Cheers,
mark


Gavin M. Roy wrote:
In 8.3.0, I'm seeing some oddities with SQL functions which I thought were immune to the planner data restrictions of plpgsql functions and the sort.  Basically I have a query which executes in 5ms but when wrapped in a SQL function, takes 500ms.  I've checked all the types passed in to make sure they match so there is no type conversions taking place in execution.

I'm curious about the validity of my expectation that functions created with SQL as the language should be as fast as the straight SQL counterpart.  I've previously not run into such an order of magnitude difference in using SQL functions.  Is this a change of behavior in 8.3 from 8.2?  Without specific examples, are there any recommendations on how to speed up these functions?

Thanks,

Gavin



-- 
Mark Mielke <mark@mielke.cc>
--------------040406060805030807020007--