Received: from jennifer.emc.com.ph (una-gateway.emc.com.ph [208.232.224.254]) by hub.org (8.10.1/8.10.1) with ESMTP id e6QEBIA20469 for ; Wed, 26 Jul 2000 10:11:18 -0400 (EDT) Received: from fc.emc.com.ph (emc-fc.emc.com.ph [203.176.3.197]) by jennifer.emc.com.ph (Postfix) with ESMTP id D2617D772 for ; Wed, 26 Jul 2000 22:11:14 +0800 (PST) Message-id: Date: Wed, 26 Jul 2000 22:11:15 +0800 Subject: optimize sql To: pgsql-sql@postgresql.org From: pgsql-sql@fc.emc.com.ph (pgsql-sql) MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200007/245 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.