Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9BCD2632BF3 for ; Sat, 3 Jul 2010 23:58:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 83771-10 for ; Sun, 4 Jul 2010 02:58:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 62ED46325DA for ; Sat, 3 Jul 2010 23:58:02 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 32E62348036; Sat, 3 Jul 2010 19:57:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hna+uYpO978M; Sat, 3 Jul 2010 19:57:53 -0700 (PDT) Received: from alvh.no-ip.org (unknown [186.10.3.160]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id E776C348035; Sat, 3 Jul 2010 19:57:48 -0700 (PDT) Received: by alvh.no-ip.org (Postfix, from userid 1000) id 9898343820A; Sat, 3 Jul 2010 22:47:51 -0400 (CDT) Content-Type: text/plain; charset=utf8 Cc: Eliot Gable , Craig Ringer , Craig James , pgsql-performance Subject: Re: Highly Efficient Custom Sorting From: Alvaro Herrera To: Merlin Moncure In-reply-to: References: <4C2D574E.5030308@postnewspapers.com.au> <4767.1278043730@sss.pgh.pa.us> <4C2E1587.70001@emolecules.com> <4C2E9606.8050903@postnewspapers.com.au> Date: Sat, 03 Jul 2010 22:47:51 -0400 Message-Id: <1278211564-sup-9529@alvh.no-ip.org> User-Agent: Sup/0.11 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-10 required=5 tests=BAYES_40=-0.001 X-Spam-Level: X-Archive-Number: 201007/44 X-Sequence-Number: 39433 Excerpts from Merlin Moncure's message of sáb jul 03 18:53:46 -0400 2010: > What about my suggestion doesn't work for your requirements? (btw, > let me disagree with my peers and state pl/perl is lousy for this type > of job, only sql/and pl/sql can interact with postgresql variables > natively for the most part). IIRC the other reason pl/perl sucks for this kind of thing is that it forces a subtransaction to be created before the function call, which is expensive. (I might be misremembering and what actually causes a subtransaction is a SPI call inside a PL/Perl function, which wouldn't apply here.)