Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f71GNjf97463 for ; Wed, 1 Aug 2001 12:23:45 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f71GNGC10132; Wed, 1 Aug 2001 12:23:16 -0400 (EDT) To: "Michael Richards" cc: pgsql-sql@postgresql.org Subject: Re: Exclusion List In-reply-to: <3B68202C.0001A3.93146@frodo.searchcanada.ca> References: <3B68202C.0001A3.93146@frodo.searchcanada.ca> Comments: In-reply-to "Michael Richards" message dated "Wed, 01 Aug 2001 11:28:44 -0400" Date: Wed, 01 Aug 2001 12:23:16 -0400 Message-ID: <10129.996682996@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200108/7 X-Sequence-Number: 4228 "Michael Richards" writes: > The reduction of the list doesn't seem to be terribly efficient. Here > are some strategies I've been looking at: > select id from users WHERE > id not in (select userid from sentletters where lettertype=1) AND > aclgroup IN (1,2); Try an EXCEPT, along the lines of (select id from users where conditions) except (select userid from sentletters where other-conditions); regards, tom lane