Re: How to find entries missing in 2nd table?

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: "Exner, Peter" <Exner(at)his(dot)de>
Cc: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>, SQL Postgresql List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to find entries missing in 2nd table?
Date: 2006-07-12 18:13:18
Message-ID: 1152727998.14241.24.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 2006-07-12 at 03:06, Exner, Peter wrote:
> Hi,
>
> what about
>
> SELECT controller_id FROM control
> WHERE controller_id NOT IN
> (SELECT DISTINCT controller_id FROM datapack);

That one works too, but it's generally not as fast as the left join / is
null query on large tables. Give the two a try on a test set and you
should see the speed difference.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message aurora 2006-07-12 18:39:14 Re: Unexpected SQL error for UPDATE
Previous Message Mark Stosberg 2006-07-12 13:48:37 Avoiding RI failure with INSERT ... SELECT FROM