Received: from Alex2.cte.Dal.Ca (Alex2.cte.Dal.Ca [134.190.17.62]) by hub.org (8.10.1/8.11.0) with ESMTP id e9KCISJ20838 for ; Fri, 20 Oct 2000 08:18:28 -0400 (EDT) (envelope-from CTE@Dal.Ca) Received: from ghost (Ghost.cte.Dal.Ca [134.190.17.89]) by Alex2.cte.Dal.Ca (8.9.3/8.9.3) with SMTP id JAA28071; Fri, 20 Oct 2000 09:34:05 -0300 Message-ID: <00aa01c03a8f$a2fe8f20$5911be86@cte.Dal.Ca> From: "Continuing Technical Education" To: "Michael Richards" Cc: "Pgsql-sql" References: <39EF613E.000005.22998@frodo.searchcanada.ca> Subject: Re: Conditional query plans. Date: Fri, 20 Oct 2000 09:16:55 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200010/188 X-Sequence-Number: 1850 > 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 :)