Re: [HACKERS] [WIP] Zipfian distribution in pgbench - Mailing list pgsql-hackers

From Alik Khilazhev
Subject Re: [HACKERS] [WIP] Zipfian distribution in pgbench
Date
Msg-id 5FD3F866-CA30-4634-9D48-DE669A84248C@postgrespro.ru
Whole thread Raw
In response to Re: [HACKERS] [WIP] Zipfian distribution in pgbench  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: [HACKERS] [WIP] Zipfian distribution in pgbench  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
Hello Fabien,

>
> I think that this method should be used for a>1, and the other very rough one can be kept for parameter a in [0, 1),
acase which does not make much sense to a mathematician as it diverges if unbounded. 

Now “a” does not have upper bound, that’s why on using iterative algorithm with a >= 10000 program will stuck on
infiniteloop because of following line of code: 
double b = pow(2.0, s - 1.0);
Because after overflow “b” becomes “+Inf”.

So should upper bound for “a" be set?

Should I mention in docs that there are two algorithms are used depending on values of a(s/theta)?

In attaching patch, I have added computeIterativeZipfian method and it’s usage in getZipfianRand.
Is it better to move code of computing via cache to new method, so that getZipfianRand will contain only 2
computeXXXZipfianmethod calls? 
—
Thanks and Regards,
Alik Khilazhev
Postgres Professional:
http://www.postgrespro.com
The Russian Postgres Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Gavin Flower
Date:
Subject: Re: [HACKERS] Patches I'm thinking of pushing shortly
Next
From: Christoph Berg
Date:
Subject: [HACKERS] initdb failure on Debian sid/mips64el in EventTriggerEndCompleteQuery