Re: General purpose hashing func in pgbench

Поиск
Список
Период
Сортировка
Искать
От
Fabien COELHO
Тема
Re: General purpose hashing func in pgbench
Дата
Msg-id
alpine.DEB.2.20.1801180710400.11884@lancre
Ответ на
Список
Дерево обсуждения
General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Stephen Frost <sfrost@snowman.net>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Teodor Sigaev <teodor@sigaev.ru>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Teodor Sigaev <teodor@sigaev.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench Ildar Musin <i.musin@postgrespro.ru>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>
Re: General purpose hashing func in pgbench "Daniel Verite" <daniel@manitou-mail.org>
Re: General purpose hashing func in pgbench Fabien COELHO <coelho@cri.ensmp.fr>

Hello Ildar,

Patch v8 applies cleanly and compiles. Global and local "make check ok".
Doc build ok.

>> For me "random seed" is what is passed to srandom, so the variable
>> should rather be named hash_seed because there could also be a random
>> seed (actually, there is in another parallel patch:-). Moreover, this
>> seed may or may not be random if set, so calling it "random_seed" is
>> not desirable.
>
> My intention was to introduce seed variable which potentially could be
> used in different contexts, not only for hash functions.

Yes, good point. I'd need it for the pseudo-random permutation function.

> I renamed it to 'hash_seed' for now. But what do you think about naming 
> it simply 'seed' or choosing some other general name?

ISTM "seed" that is prone to being used for something else in a script. 
What about ":default_seed", which says it all?


Some minor suggestions:

In "make_func", I'd assert that nargs is positive in the default branch.

The default seed may be created with just one assignment instead of 
repeated |= ops. Or not:-)

In evalStandardFunc, I'd suggest to avoid the ? construction and use an 
if and a direct setIntValue in both case, removing the "result" 
variable, as done in other branches (eg bitwise operators...). Maybe 
something like:

   if (func == murmur2)
     setIntValue(retval, getHashXXX(val, seed));
   else if (...)
     ...
   else
     Assert(0);

so that it is structurally ready for other hash functions if needed.

Documentation:

In the table, use official names in the description, and add wikipedia 
links, something like:

FNV hash ->
   FNV-1a hash

murmur2 hash ->
   MurmurHash2 hash


In the text:

"Hash functions accepts" -> "Hash functions 
hash, <......> and <....> accept*NO S*"

"... provided hash_seed value is used" => "... provided the value of 
:hash_seed is used, which is initialized randomly 
unless set by the command-line -D option."

ISTM that the Automatic Variable table should be in alphabetical order.

-- 
Fabien.

В списке pgsql-hackers по дате отправления
От: Konstantin Knizhnik
Дата:
От: Amit Langote
Дата:
FAQ