Re: 64-bit hash function for hstore and citext data type
Tomas Vondra <tomas.vondra@2ndquadrant.com>
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: amul sul <sulamul@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-11-22T18:51:25Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix hstore hash function for empty hstores upgraded from 8.4.
- e5a6ae97effe 9.4.21 landed
- bcbb682786a3 10.7 landed
- 8087788f6ade 9.5.16 landed
- 239abfff12a4 9.6.12 landed
- 02e669c0f7dd 11.2 landed
- d5890f49da6a 12.0 landed
-
Add a 64-bit hash function for type hstore.
- eb6f29141bed 12.0 landed
-
Add a 64-bit hash function for type citext.
- 48c41fa97480 12.0 landed
-
Introduce 64-bit hash functions with a 64-bit seed.
- 81c5e46c490e 11.0 cited
On 9/26/18 12:20 PM, amul sul wrote: > Hi all, > > Commit[1] has added 64-bit hash functions for core data types and in the same > discussion thread[2] Robert Haas suggested to have the similar extended hash > function for hstore and citext data type. Attaching patch proposes the same. > I wonder if the hstore hash function is actually correct. I see it pretty much just computes hash on the varlena representation. The important question is - can there be two different encodings for the same hstore value? If that's possible, those two versions would end up with a different hash value, breaking the hashing scheme. I'm not very familiar with hstore internals so I don't know if that's actually possible, but if you look at hstore_cmp, that seems to be far more complex than just comparing the varlena values directly. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services