Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 46F8C1337B6D for ; Tue, 30 Nov 2010 19:42:48 -0400 (AST) 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 13799-02 for ; Tue, 30 Nov 2010 23:42:42 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 003091336971 for ; Tue, 30 Nov 2010 19:42:41 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.4/8.14.4) with ESMTP id oAUNgePV090983 for ; Tue, 30 Nov 2010 19:42:40 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.4/8.14.4/Submit) id oAUNNucI057716 for pgsql-performance@postgresql.org; Tue, 30 Nov 2010 19:23:56 -0400 (AST) (envelope-from news) From: "T.H." X-Newsgroups: pgsql.performance Subject: Re: Question about subselect/IN performance Date: Tue, 30 Nov 2010 18:23:56 -0500 Organization: Hub.Org Networking Services Lines: 15 Message-ID: References: <4CF52C5F0200002500037FBA@gw.wicourts.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: <4CF52C5F0200002500037FBA@gw.wicourts.gov> To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.51 tagged_above=-10 required=5 tests=BAYES_05=-0.5, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/420 X-Sequence-Number: 41444 On 11/30/10 5:54 PM, Kevin Grittner wrote: > "T.H." wrote: > >> Also, are there any better ways you can think of doing such an IN >> query, using non-subselect means that might be more efficient? > > Have you tried the EXISTS predicate? > > -Kevin > Just looking into it now, thanks for the suggestion. Is there a reason that EXISTS is generally faster than IN for this sort of query? -Tristan