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 D0E169DC84B for ; Wed, 21 Dec 2005 17:24:46 -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 20239-09 for ; Wed, 21 Dec 2005 17:24:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 6D89C9DC84A for ; Wed, 21 Dec 2005 17:24:44 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jBLLOhiE097231 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 21 Dec 2005 14:24:45 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBLLOgB4059943 for ; Wed, 21 Dec 2005 14:24:42 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBLLOg7p059942 for pgsql-performance@postgresql.org; Wed, 21 Dec 2005 14:24:42 -0700 (MST) (envelope-from mfuhr) Date: Wed, 21 Dec 2005 14:24:42 -0700 From: Michael Fuhr To: pgsql-performance@postgresql.org Subject: Re: Speed of different procedural language Message-ID: <20051221212442.GA59736@winnie.fuhr.org> References: <20051221110647.GA17360@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051221110647.GA17360@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.033 required=5 tests=[AWL=0.033] X-Spam-Score: 0.033 X-Spam-Level: X-Archive-Number: 200512/544 X-Sequence-Number: 16365 On Wed, Dec 21, 2005 at 12:06:47PM +0100, Steinar H. Gunderson wrote: > On Sun, Dec 18, 2005 at 01:10:21AM -0000, Ben Trewern wrote: > > I know I should be writing these in C but that's a bit beyond me. I was > > going to try PL/Python or PL/Perl or even PL/Ruby. Has anyone any idea > > which language is fastest, or is the data access going to swamp the overhead > > of small functions? > > I'm not sure if it's what you ask for, but there _is_ a clear difference > between the procedural languages -- I've had a 10x speed increase from > rewriting PL/PgSQL stuff into PL/Perl, for instance. The difference is clear only in specific cases; just because you saw a 10x increase in some cases doesn't mean you can expect that kind of increase, or indeed any increase, in others. I've seen PL/pgSQL beat all other PL/* challengers handily many times, especially when the function does a lot of querying and looping through large result sets. I tend to use PL/pgSQL except in cases where PL/pgSQL can't do what I want or the job would be much easier in another language (e.g., string manipulation, for which I'd use PL/Perl or PL/Ruby). Even then I might use the other language only to write small functions that a PL/pgSQL function could call. As Merlin suggested, maybe Ben could tell us what he wants to do that he thinks should be written in C or a language other than PL/pgSQL. Without knowing what problem is to be solved it's near impossible to recommend an appropriate tool. -- Michael Fuhr