Re: random() in multi-threaded pgbench

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: random() in multi-threaded pgbench
Date: 2009-12-11 21:08:27
Message-ID: 23827.1260565707@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> writes:
>> http://www.kernel.org/doc/man-pages/online/pages/man3/random_r.3.html

> It only says that you need those if you want an *independent* random
> sequence for each thread. pgbench never had that before and I doubt
> we need it now. In any case, the same page also says these are a
> glibc-ism not a standard API, so we can't really rely on them.

... although if anyone was sufficiently excited about this, we could
make use of erand48() without adding any new platform dependency,
since GEQO is already relying on that. I think there's not much
point though. We'd just be moving the nearest point of failure to
the seeding algorithm --- careless seeding could still result in
duplicate sequences for different threads.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2009-12-11 21:26:24 Re: Adding support for SE-Linux security
Previous Message Tom Lane 2009-12-11 20:50:27 Re: [PATCH] dtrace probes for memory manager