Re: pgbench more operators & functions

Fabien COELHO <fabien.coelho@mines-paristech.fr>

From: Fabien COELHO <fabien.coelho@mines-paristech.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Haribabu Kommi <kommi.haribabu@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, Stephen Frost <sfrost@snowman.net>, Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-01-25T07:19:20Z
Lists: pgsql-hackers
Hello Tom,

> I concur that this is expanding pgbench's expression language well beyond
> what anybody has shown a need for.

As for the motivation, I'm assuming that pgbench should provide features 
necessary to implement benchmarks, so I'm adding operators that appear in 
standard benchmark specifications.

From TPC-B 2.0.0 section 5.3.5:

  | The Account_ID is generated as follows:
  | • A random number X is generated within [0,1]
  | • If X<0.85 or branches = 1, a random Account_ID is selected over all
  |   <Branch_ID> accounts.
  | • If X>=0.85 and branches > 1, a random Account_ID is selected over all
  |   non-<Branch_ID> accounts.

The above uses a condition (If), logic (or, and), comparisons (=, <, >=).

Commits

  1. Improve scripting language in pgbench