X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 22C2F9DCC29 for ; Mon, 13 Feb 2006 17:59:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33077-05 for ; Mon, 13 Feb 2006 17:59:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hotmail.com (bay106-dav24.bay106.hotmail.com [65.54.161.96]) by postgresql.org (Postfix) with ESMTP id A56529DCC22 for ; Mon, 13 Feb 2006 17:59:15 -0400 (AST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 13 Feb 2006 13:59:17 -0800 Message-ID: Received: from 85.105.24.123 by BAY106-DAV24.phx.gbl with DAV; Mon, 13 Feb 2006 21:59:16 +0000 X-Originating-IP: [85.105.24.123] X-Originating-Email: [a_dursun@hotmail.com] X-Sender: a_dursun@hotmail.com From: "Adnan DURSUN" To: , Subject: Re: SQL Function Performance Date: Mon, 13 Feb 2006 23:58:59 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0003_01C630F9.74C5AE20" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 13 Feb 2006 21:59:17.0205 (UTC) FILETIME=[BC0B7050:01C630E8] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.476 required=5 tests=[AWL=0.556, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 2.476 X-Spam-Level: ** X-Archive-Number: 200602/146 X-Sequence-Number: 17132 This is a multi-part message in MIME format. ------=_NextPart_000_0003_01C630F9.74C5AE20 Content-Type: text/plain; charset="iso-8859-9" Content-Transfer-Encoding: quoted-printable >From: Mark Liberman >Date: 02/13/06 22:09:48 >To: Adnan DURSUN; pgsql-performance@postgresql.org >Subject: RE: [PERFORM] SQL Function Performance >I've run into this issue. It basically comes down to the plan that is = being used inside the function is not the same as the plan used when you = issue the query manually >outside of the function. Although I'm no = expert on when plans are prepared and re-evaluated for functions, I know = that they are not re-evaluated each time to execute the >function. in my case; both direct query and sql function gererate same execution = plan. Also, execution plan belongs to the sql function better than = direct sql query plan. But, direct sql result comes less than 1 second. = sql function result comes about in 50 seconds. Adnan DURSUN ASRIN Bili=FEim Ltd.=DEti ------=_NextPart_000_0003_01C630F9.74C5AE20 Content-Type: text/html; charset="iso-8859-9" Content-Transfer-Encoding: quoted-printable
>Date: = 02/13/06=20 22:09:48
>To: Adnan DURSUN; pgsql-performance@postgr= esql.org
>Subject: RE: = [PERFORM]=20 SQL Function Performance
 

>I've run into this issue. It basically comes down = to the=20 plan that is being used inside the function is not the same as the plan = used=20 when you issue the query manually >outside of the function.  = Although=20 I'm no expert on when plans are prepared and re-evaluated for functions, = I know=20 that they are not re-evaluated each time to execute the=20 >function.

 in my case; both direct query and sql function = gererate=20 same execution plan. Also, execution plan belongs to the sql function = better=20 than direct sql query plan. But, direct sql result comes less than 1 = second. sql=20 function result comes about in 50 seconds.

Adnan DURSUN
ASRIN Bili=FEim Ltd.=DEti
------=_NextPart_000_0003_01C630F9.74C5AE20--