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

From Fabien COELHO
Subject Re: add modulo (%) operator to pgbench
Date
Msg-id alpine.DEB.2.10.1501011355000.8764@sto
Whole thread Raw
In response to Re: add modulo (%) operator to pgbench  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
Hello David,

> At the moment I feel the patch is a bit half done. I really think that
> since the gaussian and exponential stuff was added in commit ed802e7d, that
> this should now be changed so that we have functions like random(),
> erandom() and grandom() and the way to use this becomes:

> \set name random(1,10)
> \set name erandom(1,10)
>
> And we completely pull out the new \\setrandom additions added in that
> commit. We'd likely keep \\setrandom name 1 10 for backwards compatibility.

> Does anyone else feel strongly about fixing this now, while we have the
> chance?

I thought about adding functions, possibly random, very probably abs & 
some hash, but I felt it would be more for a second round.

The other point is that although uniform random is fine, the gaussian and 
exponential ones require an additional floating point argument which means 
handling some typing.

The current patch is "just" about handling operators as before, although 
in a much nicer and extensible way, thus I would suggest to let Robert's 
patch more or less as it is, and people will be able to propose new 
extensions later on.

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Transactions involving multiple postgres foreign servers
Next
From: Robert Haas
Date:
Subject: Re: Misaligned BufferDescriptors causing major performance problems on AMD