Re: General purpose hashing func in pgbench

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Ildar Musin <i(dot)musin(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: General purpose hashing func in pgbench
Date: 2017-12-26 17:42:56
Message-ID: alpine.DEB.2.20.1712261822040.22976@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Bonjour Daniel,

>> Most "permutation" functions are really cryptographic cyphers which are
>> quite expensive, and require powers of two, which is not what is needed.
>> ISTM that there are some constructs to deal with arbitrary sizes based on
>> cryptographic functions, but that would make it too expensive for the
>> purpose.
>
> FWIW, you might have a look at the permuteseq extension:
> https://pgxn.org/dist/permuteseq
> It permutes an arbitrary range of 64-bit integers into itself,
> with a user-supplied key as the seed.
> Outputs are coerced into the desired range by using the
> smallest possible power of two for the Feistel cypher's
> block size, and then cycle-walking over the results.

Thanks for the pointer.

I must admit that I do not like much the iterative "cycle walking"
approach because it can be much more expensive for some values, and it
makes the cost non uniform. Without that point, the overall encryption
looks quite costly.

For testing purposes, I'm looking for "pretty cheap" and "good enough",
and for that I'm ready to forsake "cryptographic":-)

Thanks again, it made an interesting read!

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2017-12-26 18:03:48 Re: [PROPOSAL] Shared Ispell dictionaries
Previous Message Jeff Janes 2017-12-26 17:23:32 Re: Deadlock in multiple CIC.