From: Ken Hill <ken@scottshill.com>
To: chester c young <chestercyoung@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Non Matching Records in Two Tables
Date: Tue, 14 Feb 2006 17:47:02 -0800
Message-ID: <1139968023.25060.0.camel@localhost.localdomain> (raw)
In-Reply-To: <1139952295.3083.67.camel@localhost.localdomain>
References: <20060214210829.79695.qmail@web54302.mail.yahoo.com>
<1139952295.3083.67.camel@localhost.localdomain>
On Tue, 2006-02-14 at 13:24 -0800, Ken Hill wrote:
> 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@postgresql.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
>
Well, this works:
SELECT *
FROM ncccr9 a
LEFT JOIN ncccr10 b USING( key100 )
WHERE b.key100 is null;
It still seems slow. It takes about the same time to run as in MS
Access. I thought PostgreSQL would be faster.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ken@scottshill.com, chestercyoung@yahoo.com
Subject: Re: Non Matching Records in Two Tables
In-Reply-To: <1139968023.25060.0.camel@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox