Re: General purpose hashing func in pgbench

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Ildar Musin <i(dot)musin(at)postgrespro(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: General purpose hashing func in pgbench
Date: 2018-01-09 20:11:26
Message-ID: alpine.DEB.2.20.1801092000230.2326@hendaye
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Ildar,

> Sorry for a long delay. I've added hash() function which is just an
> alias for murmur2. I've also utilized variable arguments feature from
> least()/greates() functions to make optional seed parameter, but I
> consider this as a hack.

Patch needs a rebase after Teodor push for a set of pgbench functions.

> Should we probably add some infrastructure for optional arguments?

You can look at the handling of "CASE" which may or may not have an "ELSE"
clause.

I'd suggest you use a new negative argument with the special meaning for
hash, and create the seed value when missing when building the function,
so as to simplify the executor code.

Instead of 0, I'd consider providing a random default so that the hashing
behavior is not the same from one run to the next. What do you think?

Like the previous version, murmur2 with seed looks much more random than
fnv with seed...

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-01-09 20:15:16 Re: [HACKERS] [PATCH] Assert that the correct locks are held when calling PageGetLSN()
Previous Message Alexander Korotkov 2018-01-09 19:51:03 Re: Challenges preventing us moving to 64 bit transaction id (XID)?