X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E34B99DC84B for ; Wed, 18 Jan 2006 19:39:17 -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 68463-05 for ; Wed, 18 Jan 2006 19:39:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [151.155.5.143]) by postgresql.org (Postfix) with ESMTP id C2D239DC83F for ; Wed, 18 Jan 2006 19:39:15 -0400 (AST) Received: from [172.16.1.181] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.6 $ on Linux; Wed, 18 Jan 2006 16:39:18 -0700 In-Reply-To: <20060118231714.GA10125@s2.yuriev.com> References: <20060118231714.GA10125@s2.yuriev.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed Message-Id: Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: quoted-printable From: Michael Glaesemann Subject: Re: stored procedures for complex SELECTs Date: Thu, 19 Jan 2006 08:39:16 +0900 To: alex-lists-pgsql@yuriev.com X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.019 required=5 tests=[AWL=-0.313, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 1.019 X-Spam-Level: * X-Archive-Number: 200601/126 X-Sequence-Number: 23915 On Jan 19, 2006, at 8:17 , alex-lists-pgsql@yuriev.com wrote: > Are there performance advantages that can be achieved by wrapping a > complex SELECT into a stored procedure? I believe it depends on the procedural language. If it's SQL, I think =20= it may be inlined, so you'd have overhead due to the stored procedure =20= rather than the select itself would probably be minimal. In any other =20= language, there would be additional parsing overhead, I believe, so I =20= don't think it would be faster than the select itself. However, why don't you test it? Test each case in an EXPLAIN ANALYZE =20 or run some other benchmark to see if there's a performance =20 difference. Then you'll know for sure=97and have numbers to back it up. Michael Glaesemann grzm myrealbox com