Re: Fast, stable, portable hash function producing 4-byte or 8-byte values?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Erwin Brandstetter <brsaweda(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Fast, stable, portable hash function producing 4-byte or 8-byte values?
Date: 2019-12-10 22:13:23
Message-ID: 67fe6aff570841a0fab4c7b9f5c316b5d54f88c3.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2019-12-10 at 22:11 +0100, Erwin Brandstetter wrote:
> I am looking for stable hash functions producing 8-byte or 4-byte hashes from long text values in Postgres 10 or later.
>
> [...]
>
> There is an old post from 2012 by Tom Lane suggesting that hashtext() and friends are not for users:
>
> https://www.postgresql.org/message-id/24463.1329854466%40sss.pgh.pa.us

Changing a hash function would corrupt hash indexes, wouldn't it?

So I'd expect these functions to be pretty stable:

SELECT amp.amproc
FROM pg_amproc AS amp
JOIN pg_opfamily AS opf ON amp.amprocfamily = opf.oid
JOIN pg_am ON opf.opfmethod = pg_am.oid
WHERE pg_am.amname = 'hash'
AND amp.amprocnum = 1;

Or at least there would have to be a fat warning in the release notes
to reindex hash indexes.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Miles Elam 2019-12-10 22:34:12 Re: Fast, stable, portable hash function producing 4-byte or 8-byte values?
Previous Message Erwin Brandstetter 2019-12-10 21:11:25 Fast, stable, portable hash function producing 4-byte or 8-byte values?