• Tom Lane's avatar
    Arrange to generate different random sequences in the different child · 6b45e3b7
    Tom Lane authored
    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.
    6b45e3b7
pgbench.c 52.3 KB