From: | Ants Aasma <ants(dot)aasma(at)eesti(dot)ee> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: CPU costs of random_zipfian in pgbench |
Date: | 2019-02-22 10:22:43 |
Message-ID: | CA+CSw_sTce74PYmisG5DB9eqaS8ncj88bVsb0+oCzjETQn6S-Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Feb 17, 2019 at 10:52 AM Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> > I'm trying to use random_zipfian() for benchmarking of skewed data sets,
> > and I ran head-first into an issue with rather excessive CPU costs.
> > [...] This happens because generalizedHarmonicNumber() does this:
> >
> > for (i = n; i > 1; i--)
> > ans += pow(i, -s);
> >
> > where n happens to be 1000000000 (range passed to random_zipfian), so
> > the loop takes quite a bit of time.
>
> If you find a better formula for the harmonic number, you are welcome
> and probably get your name on it:-)
>
There are pretty good approximations for s > 1.0 using Riemann zeta
function and Euler derived a formula for the s = 1 case.
I also noticed that i is int in this function, but n is int64. That seems
like an oversight.
Regards,
Ants Aasma
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2019-02-22 10:57:11 | Re: list append syntax for postgresql.conf |
Previous Message | Matsumura, Ryo | 2019-02-22 09:59:26 | RE: SQL statement PREPARE does not work in ECPG |