Re: [PERFORM] Index Usage using IN

2006-02-01 Thread Hari Warrier
Select ID from TableA where not exists ( Select ID from Table B where ID = TableA.ID) might give you index scan. Of course, that is only useful is TableA is very small table. Not appropriate for 250k rows on 2/1/2006 12:12 PM Ralph Mason said the following: Hi, I have 2 tables both have an

Re: [PERFORM] Index Usage using IN

2006-02-01 Thread Bruno Wolff III
On Thu, Feb 02, 2006 at 09:12:59 +1300, Ralph Mason <[EMAIL PROTECTED]> 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) > > T

Re: [PERFORM] Index Usage using IN

2006-02-01 Thread Tom Lane
"Jeffrey W. Baker" <[EMAIL PROTECTED]> writes: > On Thu, 2006-02-02 at 09:12 +1300, Ralph Mason wrote: >> 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 Also, increasing work_mem might persuade the

Re: [PERFORM] Index Usage using IN

2006-02-01 Thread Jeffrey W. Baker
On Wed, 2006-02-01 at 12:22 -0800, Jeffrey W. Baker wrote: > 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

Re: [PERFORM] Index Usage using IN

2006-02-01 Thread Jeffrey W. Baker
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: SELEC

[PERFORM] Index Usage using IN

2006-02-01 Thread Ralph Mason
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) This always generates sequential scans. Table A has about 250,000 rows. Table B has about 250,00