Re: General purpose hashing func in pgbench

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Fabien COELHO" <coelho(at)cri(dot)ensmp(dot)fr>
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 11:03:54
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Fabien COELHO wrote:

> 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:
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.

Best regards,
Daniel Vérité
PostgreSQL-powered mailer:
Twitter: @DanielVerite

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2017-12-26 11:11:22 PathNameCreateTemporaryDir() vs concurrency
Previous Message Arthur Zakirov 2017-12-26 10:51:03 Re: [HACKERS] Flexible configuration for full-text search