"NOT IN" predicate hangs result - Mailing list pgsql-general

From Rick Szeto
Subject "NOT IN" predicate hangs result
Date
Msg-id scb57b35.055@toronto.csi.ca
Whole thread Raw
Responses Re: "NOT IN" predicate hangs result  (Neil Conway <nconway@klamath.dyndns.org>)
Re: "NOT IN" predicate hangs result  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
Hi all,
   I recently tried this select statement and it hung my tool:

1)   select count(*) from user_profile where address_id not in (select address_id from address);

Originally, I just thought that it was slow, so I left it over night and when I can back the next morning it
just hung there(eating up CPU cycles). I looked in Celko's book and then tried this and it worked(quite fast):

2)   select count(*) from user_profile up where not exists (select * from address addr where up.address_id =
addr.address_id);

Is this a known problem?

Thanks
Rick


pgsql-general by date:

Previous
From: noy
Date:
Subject: Date precision problem
Next
From: Gunther Schadow
Date:
Subject: Re: Critical performance problems on large databases