Re: pgbench - add pseudo-random permutation function

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Hironobu SUZUKI <hironobu(at)interdb(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - add pseudo-random permutation function
Date: 2021-03-13 15:42:18
Message-ID: alpine.DEB.2.22.394.2103131548550.771005@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Alvaro,

> Clearly we got rid of a lot of code. About the tests, maybe the easiest
> thing to do is "skip ... if $Config{'osname'} eq 'MSWin32'".

I tried that.

> One comment in pseudorandom_perm talks about "whitening" while the other
> talks about "scramble". I think they should both use the same term to
> ease understanding.

Good point.

> You kept routine nbits() which is unneeded now.

Indeed.

> pgbench.c gains too many includes for my taste. Can we put
> pseudorandom_perm() in a separate file?

The refactoring I was thinking about for some time now is to separate
expression evaluation entirely, not just one function, and possibly other
parts as well. I suggest that this should wait for another submission.

> The function name pr_perm() is much too short; I think we should use a
> more descriptive name; maybe \prand_perm is sufficient? Though I admit
> the abbreviation "perm" evokes "permission" more than "permutation" to
> me, so maybe \prand_permutation is better? (If you're inclined to
> abbreviate permutation, maybe \prand_permut?)

What about simply "permute"? Pgbench is unlikely to get another permute
function anyway.

> I think the reference docs are not clear enough. What do you think of
> something like this?

I agree that the documentation is not clear enough. The proposal would not
help me to understand what it does, though. I've tried to improve the
explanation based on wikipedia explanations about permutations.

See attached v22.

--
Fabien.

Attachment Content-Type Size
pgbench-prp-func-22.patch text/x-diff 17.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2021-03-13 15:48:33 Re: Different compression methods for FPI
Previous Message Mark Dilger 2021-03-13 15:20:00 Re: pg_amcheck contrib application