From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | KONDO Mitsumasa <kondo(dot)mitsumasa(at)lab(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: gaussian distribution pgbench |
Date: | 2014-03-17 08:46:17 |
Message-ID: | 5326B659.5030802@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 03/15/2014 08:53 AM, Fabien COELHO wrote:
>> >* Does min and max really make sense for gaussian and exponential
>> >distributions? For gaussian, I would expect mean and standard deviation as
>> >the parameters, not min/max/threshold.
> Yes... and no:-) The aim is to draw an integer primary key from a table,
> so it must be in a specified range.
Well, I don't agree with that aim. It's useful for choosing a primary
key, as in the pgbench TPC-B workload, but a gaussian distributed random
number could be used for many other things too. For example:
\setrandom foo ... gaussian
select * from cheese where weight > :foo
And :foo should be a float, not an integer. That's what I was trying to
say earlier, when I said that the variable should be a float. If you
need an integer, just cast or round it in the query.
I realize that the current \setrandom sets the variable to an integer,
so gaussian/exponential would be different. But so what? An option to
generate uniformly distributed floats would be handy too, though.
> This is approximated by drawing a
> double value with the expected distribution (gaussian or exponential) and
> project it carefully onto integers. If it is out of range, there is a loop
> and another value is drawn. The minimal threshold constraint (2.0) ensures
> that the probability of looping is low.
Well, that's one way to do constraint it to the given range, but there
are many other ways to do it. Like, clamp it to the min/max if it's out
of range. I don't think we need to choose any particular method, you can
handle that in the test script.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2014-03-17 09:02:23 | Re: gaussian distribution pgbench |
Previous Message | KONDO Mitsumasa | 2014-03-17 08:40:35 | Re: gaussian distribution pgbench |