Michelle Murrain <[EMAIL PROTECTED]> writes:
> The OUTER JOIN version is quite a bit more efficient (by an order of magnitude)
> than the option with WHERE NOT EXISTS subquery.
This is going to be heavily dependent on the version of postgres. IN/NOT IN
execution has improved a lot in 7.4 and lat
Thomas F.O'Connell wrote:
I think the OUTER JOIN version is probably more efficient, but EXPLAIN
would tell you.
Well, this all makes me feel better. For everyone's edification:
select registration_id FROM registrations
where registration_id not in (select registration_id from receipts);
Generates
Oct 2004 08:44:23 +0400
To: Thomas.F.O'[EMAIL PROTECTED], [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Subject: Re: [SQL] help on a query
On Friday 08 October 2004 07:10, Thomas F.O'Connell wrote:
A query that should get the job done
TED]
> Cc: [EMAIL PROTECTED]
> From: [EMAIL PROTECTED]
> Sender: [EMAIL PROTECTED]
> Subject: Re: [SQL] help on a query
>
> On Friday 08 October 2004 07:10, Thomas F.O'Connell wrote:
> > A query that should get the job done is:
> >
> > SELECT registration_id
>
EMAIL PROTECTED]
Subject: Re: [SQL] help on a query
On Friday 08 October 2004 07:10, Thomas F.O'Connell wrote:
> A query that should get the job done is:
>
> SELECT registration_id
> FROM registrations r
> WHERE NOT EXISTS (
> SELECT 1
> FROM receipt
On Friday 08 October 2004 07:10, Thomas F.O'Connell wrote:
> A query that should get the job done is:
>
> SELECT registration_id
> FROM registrations r
> WHERE NOT EXISTS (
> SELECT 1
> FROM receipts
> WHERE registration_id = r.registration_id
> );
Don't, PLEASE, don't !!!
drive
A query that should get the job done is:
SELECT registration_id
FROM registrations r
WHERE NOT EXISTS (
SELECT 1
FROM receipts
WHERE registration_id = r.registration_id
);
There might be a more efficient version with JOINs that don't require a
subquery, but this should get