Re: add modulo (%) operator to pgbench - Mailing list pgsql-hackers

From Mitsumasa KONDO
Subject Re: add modulo (%) operator to pgbench
Date
Msg-id CADupcHXh1HsKKRBOV+z=UsN6+Yci2pxo5vLysSiOSPySx-VvUQ@mail.gmail.com
Whole thread Raw
In response to Re: add modulo (%) operator to pgbench  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: add modulo (%) operator to pgbench
List pgsql-hackers

2014-08-06 23:38 GMT+09:00 Fabien COELHO <coelho@cri.ensmp.fr>:

Three different modulo operators seems like a lot for a language that
doesn't even have a real expression syntax, but I'll yield to whatever
the consensus is on this one.

Here is a third simpler patch which only implements the Knuth's modulo, where the remainder has the same sign as the divisor.

I would prefer this version 3 (one simple modulo based on Knuth definition) or if there is a problem version 2 (all 3 modulos). Version 1 which provides a modulo compatible with C & SQL is really useless to me.
I like version 3, it is simple and practical. And it's enough in pgbench.
If someone wants to use other implementation of modulo algorithm, he just changes his source code.

Best regards,
--
Mitsumasa KONDO

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Partitioning performance: cache stringToNode() of pg_constraint.ccbin
Next
From: Amit Kapila
Date:
Subject: Re: postgresql.auto.conf and reload