Re: updated hash functions for postgresql v1

From: Kenneth Marshall <ktm(at)rice(dot)edu>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, twraney(at)comcast(dot)net, neilc(at)samurai(dot)com
Subject: Re: updated hash functions for postgresql v1
Date: 2007-10-28 18:05:58
Message-ID: 20071028180558.GY27320@it.is.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-10-28 20:06:58 Re: updated hash functions for postgresql v1
Previous Message Simon Riggs 2007-10-28 17:27:38 Re: updated hash functions for postgresql v1