pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
optimize sql
2+ messages / 2 participants
[nested] [flat]

* optimize sql
@ 2000-07-26 14:11  pgsql-sql <pgsql-sql@fc.emc.com.ph>
  0 siblings, 1 reply; 2+ messages in thread

From: pgsql-sql@fc.emc.com.ph @ 2000-07-26 14:11 UTC (permalink / raw)
  To: pgsql-sql

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);

Can anyone tell me how to optimize it?
Thanks.





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: optimize sql
@ 2000-07-26 15:51  Ross J. Reedstrom <reedstrm@rice.edu>
  parent: pgsql-sql <pgsql-sql@fc.emc.com.ph>
  0 siblings, 0 replies; 2+ messages in thread

From: Ross J. Reedstrom @ 2000-07-26 15:51 UTC (permalink / raw)
  To: 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@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-07-26 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-26 14:11 optimize sql pgsql-sql <pgsql-sql@fc.emc.com.ph>
2000-07-26 15:51 ` Ross J. Reedstrom <reedstrm@rice.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox