"NOT IN" predicate hangs result

From: "Rick Szeto" <rszeto(at)csi(dot)ca>
To: <pgsql-general(at)postgresql(dot)org>
Subject: "NOT IN" predicate hangs result
Date: 2002-04-11 16:01:29
Message-ID: scb57b35.055@toronto.csi.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gunther Schadow 2002-04-11 16:09:05 Re: Critical performance problems on large databases
Previous Message noy 2002-04-11 15:40:38 Date precision problem