Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 04F139F9FB5 for ; Sun, 28 Oct 2007 15:06:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 97317-05 for ; Sun, 28 Oct 2007 15:05:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from is.rice.edu (is.rice.edu [128.42.42.24]) by postgresql.org (Postfix) with ESMTP id 3A4659F9FAE for ; Sun, 28 Oct 2007 15:06:01 -0300 (ADT) Received: from scan1.mail.rice.edu (scan1.mail.rice.edu [128.42.58.160]) by is.rice.edu (Postfix) with ESMTP id 7C7654187D; Sun, 28 Oct 2007 13:05:59 -0500 (CDT) Received: from is.rice.edu ([128.42.42.24]) by scan1.mail.rice.edu (scan1.mail.rice.edu [128.42.58.160]) (amavisd-new, port 10024) with ESMTP id 30474-06; Sun, 28 Oct 2007 12:05:58 -0600 (CST) Received: by is.rice.edu (Postfix, from userid 18612) id BFEAB41877; Sun, 28 Oct 2007 13:05:58 -0500 (CDT) Date: Sun, 28 Oct 2007 13:05:58 -0500 From: Kenneth Marshall To: Simon Riggs Cc: pgsql-patches@postgresql.org, twraney@comcast.net, neilc@samurai.com Subject: Re: updated hash functions for postgresql v1 Message-ID: <20071028180558.GY27320@it.is.rice.edu> References: <20071027201557.GW27320@it.is.rice.edu> <1193592458.4242.713.camel@ebony.site> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1193592458.4242.713.camel@ebony.site> User-Agent: Mutt/1.5.16 (2007-06-09) X-Virus-Scanned: by amavis-2.2.1 at scan1.mail.rice.edu X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/229 X-Sequence-Number: 4228 On Sun, Oct 28, 2007 at 05:27:38PM +0000, Simon Riggs wrote: > On Sat, 2007-10-27 at 15:15 -0500, Kenneth Marshall wrote: > > Its features include a better and faster hash function. > > Looks very promising. Do you have any performance test results to show > it really is faster, when compiled into Postgres? Better probably needs > some definition also; in what way are the hash functions better? > > -- > Simon Riggs > 2ndQuadrant http://www.2ndQuadrant.com > The new hash function is roughly twice as fast as the old function in terms of straight CPU time. It uses the same design as the current hash but provides code paths for aligned and unaligned access as well as separate mixing functions for different blocks in the hash run instead of having one general purpose block. I think the speed will not be an obvious win with smaller items, but will be very important when hashing larger items (up to 32kb). Better in this case means that the new hash mixes more thoroughly which results in less collisions and more even bucket distribution. There is also a 64-bit varient which is still faster since it can take advantage of the 64-bit processor instruction set. Ken