X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 291B39FA3A6 for ; Wed, 24 May 2006 22:32:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 34392-05 for ; Wed, 24 May 2006 22:32:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from projects.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id A4EA79FA15F for ; Wed, 24 May 2006 22:32:05 -0300 (ADT) Received: from [192.168.1.50] (or-67-76-146-141.sta.sprint-hsd.net [67.76.146.141]) (authenticated bits=0) by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id k4P1W1Es002692; Wed, 24 May 2006 18:32:02 -0700 Message-ID: <4475090C.6010303@commandprompt.com> Date: Wed, 24 May 2006 18:31:56 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Thunderbird 1.5.0.2 (X11/20060521) MIME-Version: 1.0 To: kynn@panix.com CC: pgsql-performance@postgresql.org Subject: Re: Optimizing a huge_table/tiny_table join References: <200605250052.k4P0qrT11965@panix3.panix.com> In-Reply-To: <200605250052.k4P0qrT11965@panix3.panix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88.2, clamav-milter version 0.88.2 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (projects.commandprompt.com [192.168.2.159]); Wed, 24 May 2006 18:32:02 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/460 X-Sequence-Number: 19247 > kj > > PS: FWIW, the query plan for the query with LIMIT 6000 is this: What is the explain analyze? > > QUERY PLAN > ------------------------------------------------------------------------------------- > Limit (cost=19676.75..21327.99 rows=6000 width=84) > -> Hash Join (cost=19676.75..1062244.81 rows=3788315 width=84) > Hash Cond: (upper(("outer".id)::text) = upper(("inner".id)::text)) > -> Seq Scan on huge_table h (cost=0.00..51292.43 rows=2525543 width=46) > -> Hash (cost=19676.00..19676.00 rows=300 width=38) > -> Seq Scan on tiny_table t (cost=0.00..19676.00 rows=300 width=38) > > ------------=_1148485808-20617-3-- > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/