Re: Conditional query plans.

Continuing Technical Education <cte@dal.ca>

From: "Continuing Technical Education" <CTE@Dal.Ca>
To: "Michael Richards" <michael@fastmail.ca>
Cc: "Pgsql-sql" <pgsql-sql@postgresql.org>
Date: 2000-10-20T12:16:55Z
Lists: pgsql-hackers
> update users set enabled='f',disablereason='We do not allow our
> system to be used for SPAM.' where id in (select id from users where
> loginid in (select distinct loginid from logins where
> ip='123.123.12.12'));

Would it run better as:

update users set enabled='f',disablereason='We do not allow our
system to be used for SPAM.' where id in (select distinct loginid from
logins where
ip='123.123.12.12');

Or perhaps even:

update users set enabled='f',disablereason='We do not allow our
system to be used for SPAM.' where id in (select unique id from users,logins
where
users.loginid=logins.loginid where ip='123.123.12.12');

I don't know if that helps the query plan, but it looks prettier :)