Re: add modulo (%) operator to pgbench

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: add modulo (%) operator to pgbench
Date: 2014-08-04 09:20:51
Message-ID: alpine.DEB.2.10.1408041110300.18656@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> This patch is pretty trivial.

Another slightly less trivial but more useful version.

The issue is that there are 3 definitions of modulo, two of which are fine
(Knuth floored division and Euclidian), and the last one much less useful.
Alas, C (%) & SQL (MOD) choose the bad definition:-( I really need any of
the other two. The attached patch adds all versions, with "%" and "mod"
consistent with their C and SQL unfortunate counterparts, and "fmod" and
"emod" the sane ones.

> Add modulo operator to pgbench.
>
> This is useful to compute a permutation for tests with non uniform
> accesses (exponential or gaussian), so as to avoid trivial correlations
> between neighbour keys.

--
Fabien.

Attachment Content-Type Size
pgbench-modulo-2.patch text/x-diff 2.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Seref Arikan 2014-08-04 09:54:04 How to manage shared library lifetime through C functions
Previous Message Heikki Linnakangas 2014-08-04 08:48:38 Re: Looked at TODO:Considering improving performance of computing CHAR() value lengths