Re: Non Matching Records in Two Tables

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: ken(at)scottshill(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Non Matching Records in Two Tables
Date: 2006-02-14 21:08:29
Message-ID: 20060214210829.79695.qmail@web54302.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> Here is my query SQL:
>
> SELECT key100 FROM ncccr10
> WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9);
>
> It is is running after 30 minutes. Here is the query plan:
>

I would try an outer join:

select a.key100
from ncccr10 a
left join ncccr9 b on( key100 )
where b.key100 is null;

also (hate to be obvious) have you analyzed lately?

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Maciej Piekielniak 2006-02-14 21:12:18 create table and data types
Previous Message Tom Lane 2006-02-14 21:07:29 Re: Non Matching Records in Two Tables