Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by hub.org (8.10.1/8.10.1) with ESMTP id e6QFp9A60890 for ; Wed, 26 Jul 2000 11:51:09 -0400 (EDT) Received: by rice.edu via sendmail from stdin id (Debian Smail3.2.0.102) for pgsql-sql@postgresql.org; Wed, 26 Jul 2000 10:51:07 -0500 (CDT) Date: Wed, 26 Jul 2000 10:51:07 -0500 From: "Ross J. Reedstrom" To: pgsql-sql@postgresql.org Subject: Re: optimize sql Message-ID: <20000726105107.A19381@rice.edu> Mail-Followup-To: pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0i In-Reply-To: ; from pgsql-sql@fc.emc.com.ph on Wed, Jul 26, 2000 at 10:11:15PM +0800 X-Archive-Number: 200007/246 On Wed, Jul 26, 2000 at 10:11:15PM +0800, pgsql-sql wrote: > HI! > > The SQL below is too slow. > > SELECT name FROM office, office_application > WHERE code = office_code > AND name NOT IN > (SELECT DISTINCT name FROM office, office_application > WHERE active = 't' AND code = office_code); > How does the output of the above differ from: SELECT name FROM office, office_application WHERE code = office_code AND active != 't'; Without knowing the table structures (which tables to active, code, and office_code belong to?) it's hard to suggest much else. Ross -- Ross J. Reedstrom, Ph.D., NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005