Re: pgbench - add pseudo-random permutation function

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Hironobu SUZUKI <hironobu(at)interdb(dot)jp>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - add pseudo-random permutation function
Date: 2018-10-24 11:55:46
Message-ID: alpine.DEB.2.21.1810241154210.30118@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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


Attachment Content-Type Size
pgbench-prp-func-10.patch text/x-diff 18.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2018-10-24 13:29:12 Re: [PROPOSAL]a new data type 'bytea' for ECPG
Previous Message AYahorau 2018-10-24 11:34:07 Re: Timeout parameters