Re: pgbench - add pseudo-random permutation function

From: Hironobu SUZUKI <hironobu(at)interdb(dot)jp>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Subject: Re: pgbench - add pseudo-random permutation function
Date: 2018-10-24 14:55:57
Message-ID: 1680e8eb-13e8-63f8-ee41-9444112d4523@interdb.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Fabian-san,

I reviewed 'pgbench-prp-func/pgbench-prp-func-10.patch'.

On 2018/10/24 12:55, Fabien COELHO wrote:
>
> Hello Hironobu-san,
>
>> In pseudorandom_perm(), `modular_multiply() + (key >> LCG_SHIFT)` may
>> overflow if the result of modular_multiply() is large. Therefore, I've
>> improved it.
>
>> Also, I've simplified Step 5 in modular_multiply().
>
> Attached is a v10, where I have:
>  - updated some comments
>  - the + cannot overflow because size is taken from a signed int
>    and the added value is small thanks to the shift.
>    I have put back the simple formula and added a comment about it.
>  - added a few test cases, and fix the associated checks
>

I agree your discussion before.

I checked the tests you added in this patch and I confirmed that there
is no problem.

I thinks this patch is fine.

Best regards,

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tushar 2018-10-24 14:56:28 pg_logdir_ls function throwing an error if log_filename name is not default
Previous Message Jeff Janes 2018-10-24 14:47:37 Re: Estimating number of distinct values.