Re: 64-bit hash function for hstore and citext data type

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: amul sul <sulamul(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 64-bit hash function for hstore and citext data type
Date: 2018-11-22 18:51:25
Message-ID: 60b1fd3b-7332-40f0-7e7f-f2f04f777747@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Shaplov 2018-11-22 19:01:26 Re: Add extension options to control TAP and isolation tests
Previous Message Tomas Vondra 2018-11-22 18:03:21 Re: Tid scan improvements