X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 615349FA38E for ; Wed, 10 May 2006 16:34:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 59971-03 for ; Wed, 10 May 2006 16:34:18 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from peufeu.com (boutiquenumerique.com [82.67.9.10]) by postgresql.org (Postfix) with ESMTP id 2317E9FA293 for ; Wed, 10 May 2006 16:34:17 -0300 (ADT) Received: (qmail 1656 invoked from network); 10 May 2006 21:35:41 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 10 May 2006 21:35:41 +0200 Date: Wed, 10 May 2006 21:35:39 +0200 To: "Jim C. Nasby" Subject: Re: [HACKERS] Big IN() clauses etc : feature proposal Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org References: <445F7FF8.6070707@comcast.net> <1147110142.32369.7.camel@archimedes> <20060508175013.GY99570@pervasive.com> <28288.1147111196@sss.pgh.pa.us> <8764kfz1iq.fsf@stark.xeocode.com> <20060510192401.GQ99570@pervasive.com> From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <20060510192401.GQ99570@pervasive.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/270 X-Sequence-Number: 19057 > On Tue, May 09, 2006 at 06:29:31PM +0200, PFC wrote: >> You mean the cursors'storage is in fact the same internal machinery >> as a temporary table ? > > Use the source, Luke... LOL, yeah, I should have, sorry. > See tuplestore_begin_heap in backend/utils/sort/tuplestore.c and > heap_create_with_catalog in backend/catalog/heap.c. You'll find that > creating a tuplestore is far easier than creating a temp table. I had used intuition (instead of the source) to come at the same conclusion regarding the level of complexity of these two... But I'll look at the source ;) > Perhaps it would be worth creating a class of temporary tables that used > a tuplestore, although that would greatly limit what could be done with > that temp table. Just selecting from it I guess, but that's all that's needed. Anymore would duplicate the functionality of a temp table. I find cursors awkward. The application can FETCH from them, but postgres itself can't do it in SQL, unless using FOR.. IN in plpgsql... It would be a powerful addition to be able to split queries, factor out common parts between multiple queries, etc, using this system, it can even be used to execute an inner part of a query, then plan the rest according to the results and execute it... without the overhead of a temp table.