Re: Hash support for arrays

From: marcin mank <marcin(dot)mank(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Hash support for arrays
Date: 2010-10-30 16:45:57
Message-ID: AANLkTindyRFhaB-dbtFHhbBst8c+U9Gd0Q0rbLZao4MZ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 30, 2010 at 6:21 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> 3. To hash, apply the element type's hash function to each array
> element.  Combine these values by rotating the accumulator left
> one bit at each step and xor'ing in the next element's hash value.
>
> Thoughts?  In particular, is anyone aware of a better method
> for combining the element hash values?
>

This would make the hash the same for arrays with elements 32 apart swapped.

This is what boost does:
http://www.systomath.com/include/Boost-1_34/doc/html/boost/hash_combine.html

Greetings

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-10-30 17:01:44 Re: Hash support for arrays
Previous Message Tom Lane 2010-10-30 16:21:36 Hash support for arrays