On Thu, 1 Jul 2021 at 19:41, Tom Lane <t...@sss.pgh.pa.us> wrote: > > Anyway, after taking a very quick look at the patch itself, I've > got just one main objection: I don't approve of putting this in > port.h or src/port/.
I haven't looked at the patch in detail, but one thing I object to is the code to choose a random integer in an arbitrary range. Currently, this is done in pgbench by getrand(), which has its problems. However, this patch seems to be replacing that with a simple modulo operation, which is perhaps the worst possible way to do it. There's plenty of research out there on how to do it better -- see, for example, [1] for a nice summary. Also, I'd say that functions to choose random integers in an arbitrary range ought to be part of the common API, as they are in almost every language's random API. Regards, Dean [1] https://www.pcg-random.org/posts/bounded-rands.html