X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AA4B2329CF7 for ; Thu, 23 Sep 2004 15:44:55 +0100 (BST) 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 46795-02 for ; Thu, 23 Sep 2004 14:44:42 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 6F799329D22 for ; Thu, 23 Sep 2004 15:44:45 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i8NEidfi048346 for ; Thu, 23 Sep 2004 14:44:39 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i8NE4LWC032363 for pgsql-performance@postgresql.org; Thu, 23 Sep 2004 14:04:21 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.performance Subject: Re: 7.4 vs 7.3 ( hash join issue ) Date: Thu, 23 Sep 2004 16:04:20 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 35 Message-ID: <4152D7E4.3010409@bigfoot.com> References: <87sm9acih3.fsf@stark.xeocode.com> <14106.1095875794@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Tom Lane User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en In-Reply-To: <14106.1095875794@sss.pgh.pa.us> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/236 X-Sequence-Number: 8364 Tom Lane wrote: > Greg Stark writes: > >>No, postgres didn't do things in reverse order. It hashed the empty table and >>then went ahead and checked every record of the non-empty table against the >>empty hash table. > > >>Reading the code there's no check for this, and it seems like it would be a >>useful low-cost little optimization. > > > Yeah, I was just looking at doing that. > > It would also be interesting to prefetch one row from the outer table and fall > out immediately (without building the hash table) if the outer table is > empty. This seems to require some contortion of the code though :-( > > >>I think postgres normally hashes the table it thinks is smaller, > > > Right, it will prefer to put the physically smaller table (estimated > width*rows) on the inside. Do you plan to do a patch for the 7.4, so I'll wait for a 7.4.6 ( that IIRC have already two important patches pending ) or is 8.0 stuff ? Regards Gaetano Mendola