Thread: pgsql: Arrange to generate different random sequences in the different

pgsql: Arrange to generate different random sequences in the different

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Arrange to generate different random sequences in the different child
processes of a pgbench run, when we are using -j > 1 and are emulating
threads via fork().  Otherwise the children all inherit the same random
sequence state and produce the same random-number sequence.

In the threaded case the different threads will share one RNG state, so
they will produce different subsets of one sequence, which is maybe more
correlated than a purist would like but will not be "the same".  So we
leave that case alone.

First noticed by Takahiro Itagaki, and is also part of the explanation
for the pgbench misbehavior recently reported by Jaime Casanova.

Modified Files:
--------------
    pgsql/contrib/pgbench:
        pgbench.c (r1.91 -> r1.92)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/pgbench/pgbench.c?r1=1.91&r2=1.92)