X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 93E759DC80A; Wed, 1 Mar 2006 12:31:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24315-05; Wed, 1 Mar 2006 12:31:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 033799DC828; Wed, 1 Mar 2006 12:31:51 -0400 (AST) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 01 Mar 2006 10:31:44 -0600 Message-Id: <44056AE5.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0 Date: Wed, 01 Mar 2006 09:35:33 -0600 From: "Kevin Grittner" To: "Jim Nasby" Cc: ,, "Tom Lane" Subject: Re: [PERFORM] temporary indexes References: <44041B68.EE98.0025.0@wicourts.gov> <16076.1141146348@sss.pgh.pa.us> <440435BC.EE98.0025.0@wicourts.gov> <20060228210232.GW82012@pervasive.com> In-Reply-To: <20060228210232.GW82012@pervasive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.085 required=5 tests=[AWL=0.085] X-Spam-Score: 0.085 X-Spam-Level: X-Archive-Number: 200603/15 X-Sequence-Number: 80413 >>> On Tue, Feb 28, 2006 at 3:02 pm, in message <20060228210232.GW82012@pervasive.com>, "Jim C. Nasby" wrote: > > Maybe it's just the way my twisted mind thinks, but I generally prefer > using a JOIN when possible... Definitely. But sometimes you don't want one row from a table for each qualifying row in another table, you want one row from the table if one or more qualifying rows exist in the other table. Those are the cases in question here. Don't suggest that I just let the duplicates happen and use DISTINCT, that is much more prone to logic errors in complex queries, and typically optimizes worse. -Kevin