Re: optimize sql

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: optimize sql
Date: 2000-07-26 15:51:07
Message-ID: 20000726105107.A19381@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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., <reedstrm(at)rice(dot)edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message pgsql-sql 2000-07-27 02:40:04 Re(2): optimize sql
Previous Message pgsql-sql 2000-07-26 14:11:15 optimize sql