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 AE1AB9FA3A3 for ; Tue, 9 May 2006 13:48:09 -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 90740-02 for ; Tue, 9 May 2006 13:48:04 -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 A493D9F9C9E for ; Tue, 9 May 2006 13:48:02 -0300 (ADT) Received: (qmail 6282 invoked from network); 9 May 2006 18:49:23 +0200 Received: from boutiquenumerique.com (HELO apollo13) (82.67.9.10) by boutiquenumerique.com with SMTP; 9 May 2006 18:49:23 +0200 Date: Tue, 09 May 2006 18:49:22 +0200 To: "Dawid Kuroczko" Subject: Re: [HACKERS] Big IN() clauses etc : feature proposal Cc: "Christian Kratzer" , "Tom Lane" , 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> <20060509105214.P90693@vesihiisi.cksoft.de> <758d5e7f0605090943p1bbfdae2p4cb28ba128288316@mail.gmail.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: <758d5e7f0605090943p1bbfdae2p4cb28ba128288316@mail.gmail.com> User-Agent: Opera M2/8.51 (Linux, build 1462) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/187 X-Sequence-Number: 18974 >> > SELECT * FROM somewhere WHERE id IN (SELECT id FROM result) > Well, you can either > SELECT * FROM somewhere JOIN (SELECT id FROM result GROUP BY id) AS > a USING (id); It's the same thing (and postgres knows it) > You might want to use PL to store values, say PLperl, or even C, say: I tried. The problem is that you need a set-returning function to retrieve the values. SRFs don't have rowcount estimates, so the plans suck. > Should work faster than a in-application solution :) Should, but don't, because of what I said above... With the version in CVS tip, supprting a fast =ANY( array ), this should be doable, though.