Re: Non Matching Records in Two Tables

From: Ken Hill <ken(at)scottshill(dot)com>
To: chester c young <chestercyoung(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Non Matching Records in Two Tables
Date: 2006-02-14 21:24:54
Message-ID: 1139952295.3083.67.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 2006-02-14 at 13:08 -0800, chester c young wrote:

> > 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

Yes, I did a VACUUM ANALYZE on the entire database before running this
query. Also, I get an error with your suggestion:

csalgorithm=# SELECT a.key100 FROM ncccr10 a
csalgorithm-# LEFT JOIN ncccr9 b ON(a.key100)
csalgorithm-# WHERE b.key100 IS Null;
ERROR: argument of JOIN/ON must be type boolean, not type character

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ken Hill 2006-02-14 21:25:36 Re: Non Matching Records in Two Tables
Previous Message Maciej Piekielniak 2006-02-14 21:12:18 create table and data types