Re: Exclusion List - Mailing list pgsql-sql

From Tom Lane
Subject Re: Exclusion List
Date
Msg-id 10129.996682996@sss.pgh.pa.us
Whole thread Raw
In response to Exclusion List  ("Michael Richards" <michael@fastmail.ca>)
List pgsql-sql
"Michael Richards" <michael@fastmail.ca> 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


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Converting epoch to timestamp?
Next
From: "Michael Richards"
Date:
Subject: Re: Exclusion List