PATCH: pgbench - random sampling of transaction written into log

Tomas Vondra <tv@fuzzy.cz>

From: "Tomas Vondra" <tv@fuzzy.cz>
To: pgsql-hackers@postgresql.org
Date: 2012-08-24T21:16:15Z
Lists: pgsql-hackers

Attachments

Hi,

attached is a patch that adds support for random sampling in pgbench, when
it's executed with "-l" flag. You can do for example this:

  $ pgbench -l -T 120 -R 1 db

and then only 1% of transactions will be written into the log file. If you
omit the tag, all the transactions are written (i.e. it's backward
compatible).

Recently I've been using pgbench on hardware that can handle a lot of
transactions (various flavors of SSDs, lots of RAM, ...), and in such
cases the log files may get pretty big (even several gigabytes for a
single 1-hour run). A reasonable random sample (along with the stats
provided by pgbench itself) is often more than enough in such cases.

kind regards
Tomas