X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CCB833A942C for ; Fri, 10 Dec 2004 22:35:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02469-03 for ; Fri, 10 Dec 2004 22:35:22 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id D49113B3B6E for ; Fri, 10 Dec 2004 18:51:03 +0000 (GMT) Received: from echo3.echoechoplus.com (echo3.echoechoplus.com [66.98.254.65]) by svr4.postgresql.org (Postfix) with ESMTP id E34515B4815 for ; Thu, 9 Dec 2004 15:27:29 +0000 (GMT) Received: from www.ke5in.com (localhost.localdomain [127.0.0.1]) by echo3.echoechoplus.com (8.12.10/8.12.10) with SMTP id iB9FPPBd002699 for ; Thu, 9 Dec 2004 09:25:25 -0600 Received: from ool-43571ba1.dyn.optonline.net ([67.87.27.161]) (SquirrelMail authenticated user db@ke5in.com) by www.ke5in.com with HTTP; Thu, 9 Dec 2004 10:25:25 -0500 (EST) Message-ID: <33039.67.87.27.161.1102605925.squirrel@www.ke5in.com> Date: Thu, 9 Dec 2004 10:25:25 -0500 (EST) Subject: filtering From: "Kevin B." To: pgsql-sql@postgresql.org Reply-To: db@ke5in.com User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200412/50 X-Sequence-Number: 19670 Hi, I have a 14 million row table with one index on two fields one is a varchar the other is a date. The combination of the two makes the row unique. Data ----------------- name date ... other fields a 1/1/01 a 1/2/01 a 1/3/01 b 1/1/01 b 1/2/01 d 1/1/01 d 1/2/01 I have a table with just the names. each name occurs once. UName --------- name a b c d I've tried a number of queries to find which name is in UName but not in Data. However, they are all taking too long (more than 30 minutes - but the hard drive is a slow 4200rpm IDE....). What is the quickest query to get the result that I want? Also, should I put another index on the Data table for "name" only? Thanks