| From: | Alik Khilazhev <a(dot)khilazhev(at)postgrespro(dot)ru> |
|---|---|
| To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
| Cc: | PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: [WIP] Zipfian distribution in pgbench |
| Date: | 2017-08-06 18:22:26 |
| Message-ID: | 35FF9C7A-0ED8-4BDD-8C66-5A095785D090@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello Fabien,
> On 5 Aug 2017, at 12:15, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>
>
> Hello Alik,
>
> I've done some math investigations, which consisted in spending one hour with Christian, a statistician colleague of mine. He took an old book out of a shelf, opened it to page 550 (roughly in the middle), and explained to me how to build a real zipfian distribution random generator.
>
> The iterative method is for parameter a>1 and works for unbounded values. It is simple to add a bound. In practice the iterative method is quite effective, i.e. number of iterations is typically small, at least if the bound is large and if parameter a is not too close to 1.
> I've attached a python3 script which implements the algorithm. It looks like magic. Beware that a C implementation should take care of float and int overflows.
>
Thank you for the script. I will rewrite it to C and add to the patch soon.
—
Thanks and Regards,
Alik Khilazhev
Postgres Professional:
http://www.postgrespro.com
The Russian Postgres Company
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2017-08-06 20:00:51 | Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values |
| Previous Message | Andres Freund | 2017-08-06 17:48:22 | Re: Replication to Postgres 10 on Windows is broken |