Hash support for arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Hash support for arrays
Date: 2010-10-30 16:21:36
Message-ID: 26749.1288455696@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I was reminded today that I'd promised to do $SUBJECT awhile back.
It's worth having so that hash joins and hash aggregation can work
on array values. I believe this is a fairly straightforward
exercise:

1. Add a hash opclass that accepts ANYARRAY, similar to the existing
btree opclass for ANYARRAY. It will work for any array type whose
element type has a hash opclass.

2. Coding is much like the array_cmp support code, including caching
the lookup of the element type's hash function.

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?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message marcin mank 2010-10-30 16:45:57 Re: Hash support for arrays
Previous Message Andres Freund 2010-10-30 09:05:17 Re: [RFC][PATCH]: CRC32 is limiting at COPY/CTAS/INSERT ... SELECT + speeding it up