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 ED0A09DC85F for ; Wed, 1 Feb 2006 16:22:54 -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 25298-08 for ; Wed, 1 Feb 2006 16:22:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gghcwest.com (adsl-71-128-90-172.dsl.pltn13.pacbell.net [71.128.90.172]) by postgresql.org (Postfix) with ESMTP id D79B79DCDDE for ; Wed, 1 Feb 2006 16:22:51 -0400 (AST) Received: from toonses.gghcwest.com (toonses.gghcwest.com [192.168.168.115]) by gghcwest.com (8.12.10/8.12.9) with ESMTP id k11KMomd019604 for ; Wed, 1 Feb 2006 12:22:50 -0800 Received: from jwb by toonses.gghcwest.com with local (Exim 4.52) id 1F4OV9-0002EG-HF for pgsql-performance@postgresql.org; Wed, 01 Feb 2006 12:22:51 -0800 Subject: Re: Index Usage using IN From: "Jeffrey W. Baker" To: pgsql-performance@postgresql.org In-Reply-To: <43E1164B.7020104@telogis.com> References: <43E1164B.7020104@telogis.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Wed, 01 Feb 2006 12:22:50 -0800 Message-Id: <1138825370.8376.5.camel@toonses.gghcwest.com> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.09 required=5 tests=[AWL=0.090] X-Spam-Score: 0.09 X-Spam-Level: X-Archive-Number: 200602/24 X-Sequence-Number: 17010 On Thu, 2006-02-02 at 09:12 +1300, Ralph Mason wrote: > Hi, > > I have 2 tables both have an index on ID (both ID columns are an oid). > > I want to find only only rows in one and not the other. > > Select ID from TableA where ID not IN ( Select ID from Table B) Have you considered this: SELECT ID from TableA EXCEPT Select ID from Table B ? -jwb