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-23 10:11:32 |
Message-ID: | 29821e16-2877-4681-c9fd-3b3fdbfe089d@interdb.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
> Also, the alternate implementation should not change the result, so
> something looks amiss in your version. Moreover, I'm unclear how to
> implement an overflow multiply with the safe no overflow version.
(snip)
I made an honest mistake. I had assumed the modulo number of Knuth's LCG
is (2 ^ 64 - 1).
BTW, I found other overflow issue.
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().
I attached pgbench-prp-func-9.patch.
Best regards,
Attachment | Content-Type | Size |
---|---|---|
pgbench-prp-func-9.patch | text/plain | 17.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey Lepikhov | 2018-10-23 10:35:21 | Re: Making all nbtree entries unique by having heap TIDs participate in comparisons |
Previous Message | Laurenz Albe | 2018-10-23 07:42:16 | Re: Function to promote standby servers |