[PATCH] add long options to pgbench (submission 1)

Started by Fabien COELHOover 12 years ago18 messages
#1Fabien COELHO
coelho@cri.ensmp.fr
1 attachment(s)

This is mostly for reference to the next commitfest.

This very minor patch adds a corresponding long option to all short (one
letter) options of pgbench. In particular for connection options there is
now --host --username --port options similar to the "psql" client.

While I was at developing some small extensions to pgbench, ISTM that I
could do that without much effort.

Note that I'm not so sure about whether to chose singular or plural long
option names.

--
Fabien.

Attachments:

pgbench-longopts.patchtext/x-diff; name=pgbench-longopts.patchDownload
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index bc01f07..7109305 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2080,6 +2080,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* long/short named options*/
+		{"initialize", no_argument, NULL, 'i'},
+		{"host", required_argument, NULL, 'h'},
+		{"no-vacuum", no_argument, NULL, 'n'},
+		{"vacuum-all", no_argument, NULL, 'v'},
+		{"port", required_argument, NULL, 'p'},
+		{"debug", no_argument, NULL, 'd'},
+		{"select-only", no_argument, NULL, 'S'},
+		{"skip-some-update", no_argument, NULL, 'N'},
+		{"client", required_argument, NULL, 'c'},
+		{"jobs", required_argument, NULL, 'j'},
+		{"connect", no_argument, NULL, 'C'},
+		{"report-latencies", no_argument, NULL, 'r'},
+		{"scale", required_argument, NULL, 's'},
+		{"transactions", required_argument, NULL, 't'},
+		{"time", required_argument, NULL, 'T'},
+		{"username", required_argument, NULL, 'U'},
+		{"log", no_argument, NULL, 'l'},
+		{"quiet-log", no_argument, NULL, 'q'},
+		{"file", required_argument, NULL, 'f'},
+		{"define", required_argument, NULL, 'D'},
+		{"fill-factor", required_argument, NULL, 'F'},
+		{"query-mode", required_argument, NULL, 'M'},
+		/* long-named only options */
 		{"foreign-keys", no_argument, &foreign_keys, 1},
 		{"index-tablespace", required_argument, NULL, 3},
 		{"tablespace", required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 79b4baf..bc84ec0 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-i</option></term>
+      <term><option>--initialize</option></term>
       <listitem>
        <para>
         Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming after initialization.
@@ -168,6 +170,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-F</option> <replaceable>fillfactor</></term>
+      <term><option>--fill-factor</option> <replaceable>fillfactor</></term>
       <listitem>
        <para>
         Create the <structname>pgbench_accounts</>,
@@ -180,6 +183,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Multiply the number of rows generated by the scale factor.
@@ -196,6 +200,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-q</option></term>
+      <term><option>--quiet-log</option></term>
       <listitem>
        <para>
         Switch logging to quiet mode, producing only one progress message per 5
@@ -259,6 +264,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-c</option> <replaceable>clients</></term>
+      <term><option>--client</option> <replaceable>clients</></term>
       <listitem>
        <para>
         Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-C</option></term>
+      <term><option>--connect</option></term>
       <listitem>
        <para>
         Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-d</option></term>
+      <term><option>--debug</option></term>
       <listitem>
        <para>
         Print debugging output.
@@ -289,6 +297,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-D</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
+      <term><option>--define</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
       <listitem>
        <para>
         Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-f</option> <replaceable>filename</></term>
+      <term><option>--file</option> <replaceable>filename</></term>
       <listitem>
        <para>
         Read transaction script from <replaceable>filename</>.
@@ -311,6 +321,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-j</option> <replaceable>threads</></term>
+      <term><option>--jobs</option> <replaceable>threads</></term>
       <listitem>
        <para>
         Number of worker threads within <application>pgbench</application>.
@@ -324,6 +335,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-l</option></term>
+      <term><option>--log</option></term>
       <listitem>
        <para>
         Write the time taken by each transaction to a log file.
@@ -367,6 +379,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-M</option> <replaceable>querymode</></term>
+      <term><option>--query-mode</option> <replaceable>querymode</></term>
       <listitem>
        <para>
         Protocol to use for submitting queries to the server:
@@ -389,6 +402,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming before running the test.
@@ -403,6 +417,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-N</option></term>
+      <term><option>--skip-some-update</option></term>
       <listitem>
        <para>
         Do not update <structname>pgbench_tellers</> and
@@ -415,6 +430,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-r</option></term>
+      <term><option>--report-latencies</option></term>
       <listitem>
        <para>
         Report the average per-statement latency (execution time from the
@@ -426,6 +442,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Report the specified scale factor in <application>pgbench</>'s
@@ -440,6 +457,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-S</option></term>
+      <term><option>--select-only</option></term>
       <listitem>
        <para>
         Perform select-only transactions instead of TPC-B-like test.
@@ -449,6 +467,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-t</option> <replaceable>transactions</></term>
+      <term><option>--transactions</option> <replaceable>transactions</></term>
       <listitem>
        <para>
         Number of transactions each client runs.  Default is 10.
@@ -458,6 +477,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-T</option> <replaceable>seconds</></term>
+      <term><option>--time</option> <replaceable>seconds</></term>
       <listitem>
        <para>
         Run the test for this many seconds, rather than a fixed number of
@@ -469,6 +489,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-v</option></term>
+      <term><option>--vacuum-all</option></term>
       <listitem>
        <para>
         Vacuum all four standard tables before running the test.
@@ -495,6 +516,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-h</option> <replaceable>hostname</></term>
+      <term><option>--host</option> <replaceable>hostname</></term>
       <listitem>
        <para>
         The database server's host name
@@ -504,6 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-p</option> <replaceable>port</></term>
+      <term><option>--port</option> <replaceable>port</></term>
       <listitem>
        <para>
         The database server's port number
@@ -513,6 +536,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-U</option> <replaceable>login</></term>
+      <term><option>--username</option> <replaceable>login</></term>
       <listitem>
        <para>
         The user name to connect as
#2Robert Haas
robertmhaas@gmail.com
In reply to: Fabien COELHO (#1)
Re: [PATCH] add long options to pgbench (submission 1)

On Thu, May 2, 2013 at 1:59 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

This is mostly for reference to the next commitfest.

This very minor patch adds a corresponding long option to all short (one
letter) options of pgbench. In particular for connection options there is
now --host --username --port options similar to the "psql" client.

While I was at developing some small extensions to pgbench, ISTM that I
could do that without much effort.

I don't really have an opinion on whether this is worth doing, but
we'd probably want to update all of our client utilities, not just
pgbench, if we did.

Note that I'm not so sure about whether to chose singular or plural long
option names.

I've wondered that myself.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Robert Haas (#2)
Re: [PATCH] add long options to pgbench (submission 1)

Hello Robert,

This very minor patch adds a corresponding long option to all short
(one letter) options of pgbench. [...]

I don't really have an opinion on whether this is worth doing, but we'd
probably want to update all of our client utilities, not just pgbench,
if we did.

The current status is that "official" clients already have systematic long
options. I have checked: psql, pg_dump, pg_dumpall, pg_restore,
pg_basebackup, createdb, createuser, createlang. Possibly other commands
in contrib do not have long option.

As for the rational, when I type interactively I tend to use short
options, but in a script I like long options so that I may not need to
look them up in the documentation too often when reading the script later.
The other rational is that adding long options is cheap and
straightforward.

--
Fabien.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Robert Haas (#2)
1 attachment(s)
Re: [PATCH] add long options to pgbench (submission 1)

New submission which put long options in alphabetical order, which seems
more logical.

This is for reference to the next commitfest.

--
Fabien.

Attachments:

pgbench-longopts.patchtext/x-diff; name=pgbench-longopts.patchDownload
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 24dab1f..ba36e66 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2080,6 +2080,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* systematic long/short named options*/
+		{"client", required_argument, NULL, 'c'},
+		{"connect", no_argument, NULL, 'C'},
+		{"debug", no_argument, NULL, 'd'},
+		{"define", required_argument, NULL, 'D'},
+		{"file", required_argument, NULL, 'f'},
+		{"fill-factor", required_argument, NULL, 'F'},
+		{"host", required_argument, NULL, 'h'},
+		{"initialize", no_argument, NULL, 'i'},
+		{"jobs", required_argument, NULL, 'j'},
+		{"log", no_argument, NULL, 'l'},
+		{"no-vacuum", no_argument, NULL, 'n'},
+		{"port", required_argument, NULL, 'p'},
+		{"query-mode", required_argument, NULL, 'M'},
+		{"quiet-log", no_argument, NULL, 'q'},
+		{"report-latencies", no_argument, NULL, 'r'},
+		{"scale", required_argument, NULL, 's'},
+		{"select-only", no_argument, NULL, 'S'},
+		{"skip-some-update", no_argument, NULL, 'N'},
+		{"time", required_argument, NULL, 'T'},
+		{"transactions", required_argument, NULL, 't'},
+		{"username", required_argument, NULL, 'U'},
+		{"vacuum-all", no_argument, NULL, 'v'},
+		/* long-named only options */
 		{"foreign-keys", no_argument, &foreign_keys, 1},
 		{"index-tablespace", required_argument, NULL, 3},
 		{"tablespace", required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 79b4baf..bc84ec0 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-i</option></term>
+      <term><option>--initialize</option></term>
       <listitem>
        <para>
         Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming after initialization.
@@ -168,6 +170,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-F</option> <replaceable>fillfactor</></term>
+      <term><option>--fill-factor</option> <replaceable>fillfactor</></term>
       <listitem>
        <para>
         Create the <structname>pgbench_accounts</>,
@@ -180,6 +183,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Multiply the number of rows generated by the scale factor.
@@ -196,6 +200,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-q</option></term>
+      <term><option>--quiet-log</option></term>
       <listitem>
        <para>
         Switch logging to quiet mode, producing only one progress message per 5
@@ -259,6 +264,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-c</option> <replaceable>clients</></term>
+      <term><option>--client</option> <replaceable>clients</></term>
       <listitem>
        <para>
         Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-C</option></term>
+      <term><option>--connect</option></term>
       <listitem>
        <para>
         Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-d</option></term>
+      <term><option>--debug</option></term>
       <listitem>
        <para>
         Print debugging output.
@@ -289,6 +297,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-D</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
+      <term><option>--define</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
       <listitem>
        <para>
         Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-f</option> <replaceable>filename</></term>
+      <term><option>--file</option> <replaceable>filename</></term>
       <listitem>
        <para>
         Read transaction script from <replaceable>filename</>.
@@ -311,6 +321,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-j</option> <replaceable>threads</></term>
+      <term><option>--jobs</option> <replaceable>threads</></term>
       <listitem>
        <para>
         Number of worker threads within <application>pgbench</application>.
@@ -324,6 +335,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-l</option></term>
+      <term><option>--log</option></term>
       <listitem>
        <para>
         Write the time taken by each transaction to a log file.
@@ -367,6 +379,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-M</option> <replaceable>querymode</></term>
+      <term><option>--query-mode</option> <replaceable>querymode</></term>
       <listitem>
        <para>
         Protocol to use for submitting queries to the server:
@@ -389,6 +402,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming before running the test.
@@ -403,6 +417,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-N</option></term>
+      <term><option>--skip-some-update</option></term>
       <listitem>
        <para>
         Do not update <structname>pgbench_tellers</> and
@@ -415,6 +430,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-r</option></term>
+      <term><option>--report-latencies</option></term>
       <listitem>
        <para>
         Report the average per-statement latency (execution time from the
@@ -426,6 +442,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Report the specified scale factor in <application>pgbench</>'s
@@ -440,6 +457,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-S</option></term>
+      <term><option>--select-only</option></term>
       <listitem>
        <para>
         Perform select-only transactions instead of TPC-B-like test.
@@ -449,6 +467,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-t</option> <replaceable>transactions</></term>
+      <term><option>--transactions</option> <replaceable>transactions</></term>
       <listitem>
        <para>
         Number of transactions each client runs.  Default is 10.
@@ -458,6 +477,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-T</option> <replaceable>seconds</></term>
+      <term><option>--time</option> <replaceable>seconds</></term>
       <listitem>
        <para>
         Run the test for this many seconds, rather than a fixed number of
@@ -469,6 +489,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-v</option></term>
+      <term><option>--vacuum-all</option></term>
       <listitem>
        <para>
         Vacuum all four standard tables before running the test.
@@ -495,6 +516,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-h</option> <replaceable>hostname</></term>
+      <term><option>--host</option> <replaceable>hostname</></term>
       <listitem>
        <para>
         The database server's host name
@@ -504,6 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-p</option> <replaceable>port</></term>
+      <term><option>--port</option> <replaceable>port</></term>
       <listitem>
        <para>
         The database server's port number
@@ -513,6 +536,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-U</option> <replaceable>login</></term>
+      <term><option>--username</option> <replaceable>login</></term>
       <listitem>
        <para>
         The user name to connect as
#5fabriziomello
fabriziomello@gmail.com
In reply to: Fabien COELHO (#4)
Re: [PATCH] add long options to pgbench (submission 1)

New submission which put long options in alphabetical order, which seems
more logical.

This is for reference to the next commitfest.

When I applied your patch appeared the following messages:

$ patch -p1 < /tmp/pgbench-longopts.patch
patching file contrib/pgbench/pgbench.c
Hunk #1 succeeded at 2109 (offset 29 lines).
patching file doc/src/sgml/pgbench.sgml
Hunk #2 succeeded at 172 (offset 12 lines).
Hunk #3 FAILED at 170.
Hunk #4 succeeded at 193 (offset 11 lines).
Hunk #5 FAILED at 199.
Hunk #13 succeeded at 344 (offset -33 lines).
Hunk #14 succeeded at 367 (offset -33 lines).
Hunk #15 succeeded at 382 (offset -33 lines).
Hunk #16 succeeded at 395 (offset -33 lines).
Hunk #17 succeeded at 407 (offset -33 lines).
Hunk #18 succeeded at 422 (offset -33 lines).
Hunk #19 succeeded at 432 (offset -33 lines).
Hunk #20 succeeded at 442 (offset -33 lines).
Hunk #21 succeeded at 454 (offset -33 lines).
2 out of 24 hunks FAILED -- saving rejects to file
doc/src/sgml/pgbench.sgml.rej

Please fix that and re-send the patch.

Regards,

-----
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL

Blog sobre TI: http://fabriziomello.blogspot.com
Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello

--
View this message in context: http://postgresql.1045698.n5.nabble.com/PATCH-add-long-options-to-pgbench-submission-1-tp5754115p5760039.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Fabien COELHO
coelho@cri.ensmp.fr
In reply to: fabriziomello (#5)
1 attachment(s)
Re: [PATCH] add long options to pgbench (submission 1)

Please fix that and re-send the patch.

Find attached diff wrt current master.

--
Fabien.

Attachments:

pgbench-longopts-v3.patchtext/x-diff; name=pgbench-longopts-v3.patchDownload
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 1303217..f39fed3 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2109,6 +2109,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* systematic long/short named options*/
+		{"client", required_argument, NULL, 'c'},
+		{"connect", no_argument, NULL, 'C'},
+		{"debug", no_argument, NULL, 'd'},
+		{"define", required_argument, NULL, 'D'},
+		{"file", required_argument, NULL, 'f'},
+		{"fill-factor", required_argument, NULL, 'F'},
+		{"host", required_argument, NULL, 'h'},
+		{"initialize", no_argument, NULL, 'i'},
+		{"jobs", required_argument, NULL, 'j'},
+		{"log", no_argument, NULL, 'l'},
+		{"no-vacuum", no_argument, NULL, 'n'},
+		{"port", required_argument, NULL, 'p'},
+		{"query-mode", required_argument, NULL, 'M'},
+		{"quiet-log", no_argument, NULL, 'q'},
+		{"report-latencies", no_argument, NULL, 'r'},
+		{"scale", required_argument, NULL, 's'},
+		{"select-only", no_argument, NULL, 'S'},
+		{"skip-some-update", no_argument, NULL, 'N'},
+		{"time", required_argument, NULL, 'T'},
+		{"transactions", required_argument, NULL, 't'},
+		{"username", required_argument, NULL, 'U'},
+		{"vacuum-all", no_argument, NULL, 'v'},
+		/* long-named only options */
 		{"foreign-keys", no_argument, &foreign_keys, 1},
 		{"index-tablespace", required_argument, NULL, 3},
 		{"tablespace", required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 8775606..3394b93 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-i</option></term>
+      <term><option>--initialize</option></term>
       <listitem>
        <para>
         Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-F</option> <replaceable>fillfactor</></term>
+      <term><option>--fill-factor</option> <replaceable>fillfactor</></term>
       <listitem>
        <para>
         Create the <structname>pgbench_accounts</>,
@@ -171,6 +173,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming after initialization.
@@ -180,6 +183,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-q</option></term>
+      <term><option>--quiet-log</option></term>
       <listitem>
        <para>
         Switch logging to quiet mode, producing only one progress message per 5
@@ -191,6 +195,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Multiply the number of rows generated by the scale factor.
@@ -259,6 +264,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-c</option> <replaceable>clients</></term>
+      <term><option>--client</option> <replaceable>clients</></term>
       <listitem>
        <para>
         Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-C</option></term>
+      <term><option>--connect</option></term>
       <listitem>
        <para>
         Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-d</option></term>
+      <term><option>--debug</option></term>
       <listitem>
        <para>
         Print debugging output.
@@ -289,6 +297,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-D</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
+      <term><option>--define</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
       <listitem>
        <para>
         Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-f</option> <replaceable>filename</></term>
+      <term><option>--file</option> <replaceable>filename</></term>
       <listitem>
        <para>
         Read transaction script from <replaceable>filename</>.
@@ -311,6 +321,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-j</option> <replaceable>threads</></term>
+      <term><option>--jobs</option> <replaceable>threads</></term>
       <listitem>
        <para>
         Number of worker threads within <application>pgbench</application>.
@@ -324,6 +335,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-l</option></term>
+      <term><option>--log</option></term>
       <listitem>
        <para>
         Write the time taken by each transaction to a log file.
@@ -334,6 +346,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-M</option> <replaceable>querymode</></term>
+      <term><option>--query-mode</option> <replaceable>querymode</></term>
       <listitem>
        <para>
         Protocol to use for submitting queries to the server:
@@ -356,6 +369,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming before running the test.
@@ -370,6 +384,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-N</option></term>
+      <term><option>--skip-some-update</option></term>
       <listitem>
        <para>
         Do not update <structname>pgbench_tellers</> and
@@ -382,6 +397,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-r</option></term>
+      <term><option>--report-latencies</option></term>
       <listitem>
        <para>
         Report the average per-statement latency (execution time from the
@@ -393,6 +409,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Report the specified scale factor in <application>pgbench</>'s
@@ -407,6 +424,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-S</option></term>
+      <term><option>--select-only</option></term>
       <listitem>
        <para>
         Perform select-only transactions instead of TPC-B-like test.
@@ -416,6 +434,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-t</option> <replaceable>transactions</></term>
+      <term><option>--transactions</option> <replaceable>transactions</></term>
       <listitem>
        <para>
         Number of transactions each client runs.  Default is 10.
@@ -425,6 +444,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-T</option> <replaceable>seconds</></term>
+      <term><option>--time</option> <replaceable>seconds</></term>
       <listitem>
        <para>
         Run the test for this many seconds, rather than a fixed number of
@@ -436,6 +456,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-v</option></term>
+      <term><option>--vacuum-all</option></term>
       <listitem>
        <para>
         Vacuum all four standard tables before running the test.
@@ -495,6 +516,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-h</option> <replaceable>hostname</></term>
+      <term><option>--host</option> <replaceable>hostname</></term>
       <listitem>
        <para>
         The database server's host name
@@ -504,6 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-p</option> <replaceable>port</></term>
+      <term><option>--port</option> <replaceable>port</></term>
       <listitem>
        <para>
         The database server's port number
@@ -513,6 +536,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-U</option> <replaceable>login</></term>
+      <term><option>--username</option> <replaceable>login</></term>
       <listitem>
        <para>
         The user name to connect as
#7Fabrízio de Royes Mello
fabriziomello@gmail.com
In reply to: Fabien COELHO (#6)
Re: [PATCH] add long options to pgbench (submission 1)

On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

Please fix that and re-send the patch.

Find attached diff wrt current master.

Thanks.

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL

Show quoted text

Blog sobre TI: http://fabriziomello.blogspot.com
Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
Twitter: http://twitter.com/fabriziomello

#8Robert Haas
robertmhaas@gmail.com
In reply to: Fabrízio de Royes Mello (#7)
Re: [PATCH] add long options to pgbench (submission 1)

On Thu, Jun 20, 2013 at 9:17 AM, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:

On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

Please fix that and re-send the patch.

Find attached diff wrt current master.

Thanks.

I would like to solicit opinions on whether this is a good idea. I
understand that the patch author thinks it's a good idea, and I don't
have a strong position either way. But I want to hear what other
people think.

Anyone have an opinion?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#9Andres Freund
andres@2ndquadrant.com
In reply to: Robert Haas (#8)
Re: [PATCH] add long options to pgbench (submission 1)

On 2013-06-25 12:11:06 -0400, Robert Haas wrote:

On Thu, Jun 20, 2013 at 9:17 AM, Fabrízio de Royes Mello
<fabriziomello@gmail.com> wrote:

On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

Please fix that and re-send the patch.

Find attached diff wrt current master.

Thanks.

I would like to solicit opinions on whether this is a good idea. I
understand that the patch author thinks it's a good idea, and I don't
have a strong position either way. But I want to hear what other
people think.

Anyone have an opinion?

+1. When writing scripts I like to use the long options because that
makes it easier to understand some time later. I don't really see a
reason not to do this.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#10Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Robert Haas (#8)
Re: [PATCH] add long options to pgbench (submission 1)

Robert Haas escribi�:

On Thu, Jun 20, 2013 at 9:17 AM, Fabr�zio de Royes Mello
<fabriziomello@gmail.com> wrote:

On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

Please fix that and re-send the patch.

Find attached diff wrt current master.

Thanks.

I would like to solicit opinions on whether this is a good idea. I
understand that the patch author thinks it's a good idea, and I don't
have a strong position either way. But I want to hear what other
people think.

+1 from me on the general idea. Didn't check the actual patch.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#11Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert Haas (#8)
Re: [PATCH] add long options to pgbench (submission 1)

Robert Haas <robertmhaas@gmail.com> writes:

I would like to solicit opinions on whether this is a good idea. I
understand that the patch author thinks it's a good idea, and I don't
have a strong position either way. But I want to hear what other
people think.

If it makes pgbench more consistent with psql's command line options,
it seems reasonable to me.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#12Robert Haas
robertmhaas@gmail.com
In reply to: Tom Lane (#11)
Re: [PATCH] add long options to pgbench (submission 1)

On Tue, Jun 25, 2013 at 12:17 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Robert Haas <robertmhaas@gmail.com> writes:

I would like to solicit opinions on whether this is a good idea. I
understand that the patch author thinks it's a good idea, and I don't
have a strong position either way. But I want to hear what other
people think.

If it makes pgbench more consistent with psql's command line options,
it seems reasonable to me.

OK, I think it does that. So that's three votes in favor and none
opposed. I think I'd like to quibble with some of the names a bit,
though. The patch adds --fill-factor, but I think we should spell it
without the hyphen: --fillfactor. I think --quiet-log should be
spelled --quiet. I think --connect for each connection is not very
descriptive; maybe --connection-per-transaction or something, although
that's kind of long. I think -M should be aliased to --protocol, not
--query-mode. --skip-some-update is incorrectly pluralized; if that's
what we're going to use, it should be --skip-some-updates.
Alternatively, we could use --update-large-tables-only, which might
make the intent more clear.

On another note, it doesn't look like this updates the output of
pgbench --help, which seems important.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#13Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Robert Haas (#12)
1 attachment(s)
Re: [PATCH] add long options to pgbench (submission 1)

I think I'd like to quibble with some of the names a bit, though.

That is a good idea, because I'm not a native English speaker and I was
not so sure for many options.

The patch adds --fill-factor, but I think we should spell it
without the hyphen: --fillfactor.

Fine with me.

I think --quiet-log should be spelled --quiet.

ISTM that --quiet usually means "not verbose on stdout", so I added log
because this was specific to the log output, and that there may be a need
for a --quiet option for stdout at some time.

I think --connect for each connection is not very descriptive; maybe
--connection-per-transaction or something, although that's kind of long.

Yes, I think that it is too long. You have to type them!

What about '--reconnect'?

I think -M should be aliased to --protocol, not --query-mode.

Fine with me.

--skip-some-update is incorrectly pluralized; if that's
what we're going to use, it should be --skip-some-updates.

Indeed.

Alternatively, we could use --update-large-tables-only, which might
make the intent more clear.

Yep, but quite long.

On another note, it doesn't look like this updates the output of
pgbench --help, which seems important.

Indeed, it should.

Please find attached a v4 which takes into account most of your comments,
but "very very long" option names.

--
Fabien.

Attachments:

pgbench-longopts-v4.patchtext/x-diff; name=pgbench-longopts-v4.patchDownload
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 1303217..e8126f5 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -329,11 +329,16 @@ usage(void)
 		   "Usage:\n"
 		   "  %s [OPTION]... [DBNAME]\n"
 		   "\nInitialization options:\n"
-		   "  -i           invokes initialization mode\n"
-		   "  -F NUM       fill factor\n"
-		   "  -n           do not run VACUUM after initialization\n"
-		   "  -q           quiet logging (one message each 5 seconds)\n"
-		   "  -s NUM       scaling factor\n"
+		   "  -i, --initialize\n"
+		   "               invokes initialization mode\n"
+		   "  -F NUM, --fillfactor NUM\n"
+		   "               set fill factor\n"
+		   "  -n, --no-vacuum\n"
+		   "               do not run VACUUM after initialization\n"
+		   "  -q, --quiet-log\n"
+		   "               quiet logging (one message each 5 seconds)\n"
+		   "  -s NUM, --scale NUM\n"
+		   "               scaling factor\n"
 		   "  --foreign-keys\n"
 		   "               create foreign key constraints between tables\n"
 		   "  --index-tablespace=TABLESPACE\n"
@@ -343,32 +348,50 @@ usage(void)
 		   "  --unlogged-tables\n"
 		   "               create tables as unlogged tables\n"
 		   "\nBenchmarking options:\n"
-		"  -c NUM       number of concurrent database clients (default: 1)\n"
-		   "  -C           establish new connection for each transaction\n"
-		   "  -D VARNAME=VALUE\n"
+		   "  -c NUM, --client NUM\n"
+		   "               number of concurrent database clients (default: 1)\n"
+		   "  -C, --connect\n"
+		   "               establish new connection for each transaction\n"
+		   "  -D VARNAME=VALUE, --define VARNAME=VALUE\n"
 		   "               define variable for use by custom script\n"
-		   "  -f FILENAME  read transaction script from FILENAME\n"
-		   "  -j NUM       number of threads (default: 1)\n"
-		   "  -l           write transaction times to log file\n"
-		   "  -M simple|extended|prepared\n"
-		   "               protocol for submitting queries to server (default: simple)\n"
-		   "  -n           do not run VACUUM before tests\n"
-		   "  -N           do not update tables \"pgbench_tellers\" and \"pgbench_branches\"\n"
-		   "  -r           report average latency per command\n"
-		   "  -s NUM       report this scale factor in output\n"
-		   "  -S           perform SELECT-only transactions\n"
-	 "  -t NUM       number of transactions each client runs (default: 10)\n"
-		   "  -T NUM       duration of benchmark test in seconds\n"
-		   "  -v           vacuum all four standard tables before tests\n"
+		   "  -f FILENAME, --file FILENAME\n"
+		   "               read transaction script from FILENAME\n"
+		   "  -j NUM, --jobs NUM\n"
+		   "               number of threads (default: 1)\n"
+		   "  -l, --log    write transaction times to log file\n"
+		   "  -M simple|extended|prepared, --protocole ...\n"
+		   "               protocol for submitting queries to server "
+		                                           "(default: simple)\n"
+		   "  -n, --no-vacuum\n"
+		   "               do not run VACUUM before tests\n"
+		   "  -N, --skip-some-updates\n"
+		   "               do not update tables \"pgbench_tellers\""
+		                                 " and \"pgbench_branches\"\n"
+		   "  -r, --report-latencies\n"
+		   "               report average latency per command\n"
+		   "  -s NUM, --scale NUM\n"
+		   "               report this scale factor in output\n"
+		   "  -S, --select-only\n"
+		   "               perform SELECT-only transactions\n"
+		   "  -t NUM, --transactions NUM\n"
+		   "               number of transactions each client runs "
+		                                             "(default: 10)\n"
+		   "  -T NUM, --time NUM\n"
+		   "               duration of benchmark test in seconds\n"
+		   "  -v, --vacuum-all\n"
+		   "               vacuum all four standard tables before tests\n"
 		   "  --aggregate-interval=NUM\n"
 		   "               aggregate data over NUM seconds\n"
 		   "  --sampling-rate=NUM\n"
 		   "               fraction of transactions to log (e.g. 0.01 for 1%% sample)\n"
 		   "\nCommon options:\n"
-		   "  -d             print debugging output\n"
-		   "  -h HOSTNAME    database server host or socket directory\n"
-		   "  -p PORT        database server port number\n"
-		   "  -U USERNAME    connect as specified database user\n"
+		   "  -d, --debug    print debugging output\n"
+		   "  -h HOSTNAME, --host HOSTNAME\n"
+		   "                 database server host or socket directory\n"
+		   "  -p PORT, --port PORT\n"
+		   "                 database server port number\n"
+		   "  -U USERNAME, --username USERNAME\n"
+		   "                 connect as specified database user\n"
 		   "  -V, --version  output version information, then exit\n"
 		   "  -?, --help     show this help, then exit\n"
 		   "\n"
@@ -2109,6 +2132,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* systematic long/short named options*/
+		{"client", required_argument, NULL, 'c'},
+		{"connect", no_argument, NULL, 'C'},
+		{"debug", no_argument, NULL, 'd'},
+		{"define", required_argument, NULL, 'D'},
+		{"file", required_argument, NULL, 'f'},
+		{"fillfactor", required_argument, NULL, 'F'},
+		{"host", required_argument, NULL, 'h'},
+		{"initialize", no_argument, NULL, 'i'},
+		{"jobs", required_argument, NULL, 'j'},
+		{"log", no_argument, NULL, 'l'},
+		{"no-vacuum", no_argument, NULL, 'n'},
+		{"port", required_argument, NULL, 'p'},
+		{"protocol", required_argument, NULL, 'M'},
+		{"quiet-log", no_argument, NULL, 'q'},
+		{"report-latencies", no_argument, NULL, 'r'},
+		{"scale", required_argument, NULL, 's'},
+		{"select-only", no_argument, NULL, 'S'},
+		{"skip-some-updates", no_argument, NULL, 'N'},
+		{"time", required_argument, NULL, 'T'},
+		{"transactions", required_argument, NULL, 't'},
+		{"username", required_argument, NULL, 'U'},
+		{"vacuum-all", no_argument, NULL, 'v'},
+		/* long-named only options */
 		{"foreign-keys", no_argument, &foreign_keys, 1},
 		{"index-tablespace", required_argument, NULL, 3},
 		{"tablespace", required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 8775606..5a367ac 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-i</option></term>
+      <term><option>--initialize</option></term>
       <listitem>
        <para>
         Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-F</option> <replaceable>fillfactor</></term>
+      <term><option>--fillfactor</option> <replaceable>fillfactor</></term>
       <listitem>
        <para>
         Create the <structname>pgbench_accounts</>,
@@ -171,6 +173,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming after initialization.
@@ -180,6 +183,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-q</option></term>
+      <term><option>--quiet-log</option></term>
       <listitem>
        <para>
         Switch logging to quiet mode, producing only one progress message per 5
@@ -191,6 +195,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Multiply the number of rows generated by the scale factor.
@@ -259,6 +264,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-c</option> <replaceable>clients</></term>
+      <term><option>--client</option> <replaceable>clients</></term>
       <listitem>
        <para>
         Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-C</option></term>
+      <term><option>--connect</option></term>
       <listitem>
        <para>
         Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-d</option></term>
+      <term><option>--debug</option></term>
       <listitem>
        <para>
         Print debugging output.
@@ -289,6 +297,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-D</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
+      <term><option>--define</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
       <listitem>
        <para>
         Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-f</option> <replaceable>filename</></term>
+      <term><option>--file</option> <replaceable>filename</></term>
       <listitem>
        <para>
         Read transaction script from <replaceable>filename</>.
@@ -311,6 +321,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-j</option> <replaceable>threads</></term>
+      <term><option>--jobs</option> <replaceable>threads</></term>
       <listitem>
        <para>
         Number of worker threads within <application>pgbench</application>.
@@ -324,6 +335,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-l</option></term>
+      <term><option>--log</option></term>
       <listitem>
        <para>
         Write the time taken by each transaction to a log file.
@@ -334,6 +346,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-M</option> <replaceable>querymode</></term>
+      <term><option>--protocol</option> <replaceable>querymode</></term>
       <listitem>
        <para>
         Protocol to use for submitting queries to the server:
@@ -356,6 +369,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-n</option></term>
+      <term><option>--no-vacuum</option></term>
       <listitem>
        <para>
         Perform no vacuuming before running the test.
@@ -370,6 +384,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-N</option></term>
+      <term><option>--skip-some-updates</option></term>
       <listitem>
        <para>
         Do not update <structname>pgbench_tellers</> and
@@ -382,6 +397,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-r</option></term>
+      <term><option>--report-latencies</option></term>
       <listitem>
        <para>
         Report the average per-statement latency (execution time from the
@@ -393,6 +409,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-s</option> <replaceable>scale_factor</></term>
+      <term><option>--scale</option> <replaceable>scale_factor</></term>
       <listitem>
        <para>
         Report the specified scale factor in <application>pgbench</>'s
@@ -407,6 +424,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-S</option></term>
+      <term><option>--select-only</option></term>
       <listitem>
        <para>
         Perform select-only transactions instead of TPC-B-like test.
@@ -416,6 +434,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-t</option> <replaceable>transactions</></term>
+      <term><option>--transactions</option> <replaceable>transactions</></term>
       <listitem>
        <para>
         Number of transactions each client runs.  Default is 10.
@@ -425,6 +444,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-T</option> <replaceable>seconds</></term>
+      <term><option>--time</option> <replaceable>seconds</></term>
       <listitem>
        <para>
         Run the test for this many seconds, rather than a fixed number of
@@ -436,6 +456,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-v</option></term>
+      <term><option>--vacuum-all</option></term>
       <listitem>
        <para>
         Vacuum all four standard tables before running the test.
@@ -495,6 +516,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-h</option> <replaceable>hostname</></term>
+      <term><option>--host</option> <replaceable>hostname</></term>
       <listitem>
        <para>
         The database server's host name
@@ -504,6 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-p</option> <replaceable>port</></term>
+      <term><option>--port</option> <replaceable>port</></term>
       <listitem>
        <para>
         The database server's port number
@@ -513,6 +536,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
 
      <varlistentry>
       <term><option>-U</option> <replaceable>login</></term>
+      <term><option>--username</option> <replaceable>login</></term>
       <listitem>
        <para>
         The user name to connect as
#14Robert Haas
robertmhaas@gmail.com
In reply to: Fabien COELHO (#13)
Re: [PATCH] add long options to pgbench (submission 1)

On Tue, Jun 25, 2013 at 3:09 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

I think --quiet-log should be spelled --quiet.

ISTM that --quiet usually means "not verbose on stdout", so I added log
because this was specific to the log output, and that there may be a need
for a --quiet option for stdout at some time.

The output that is quieted by -q is not the log output produced by
--log; it's the regular progress output on stdout/stderr.

So I changed that, and committed this, with some further cosmetic
changes. I made the formatting of the help message more like psql's
help message, including adjusting pgbench to start the description of
each option in the same column that psql does. This got rid of a lot
of line breaks and IMHO makes the output of pgbench --help quite a bit
more readable. I made stylistic adjustments to the documentation
portion of the patch as well, again to match the markup used for psql.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#15Fujii Masao
masao.fujii@gmail.com
In reply to: Robert Haas (#14)
Re: [PATCH] add long options to pgbench (submission 1)

On Thu, Jun 27, 2013 at 10:02 PM, Robert Haas <robertmhaas@gmail.com> wrote:

On Tue, Jun 25, 2013 at 3:09 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

I think --quiet-log should be spelled --quiet.

ISTM that --quiet usually means "not verbose on stdout", so I added log
because this was specific to the log output, and that there may be a need
for a --quiet option for stdout at some time.

The output that is quieted by -q is not the log output produced by
--log; it's the regular progress output on stdout/stderr.

So I changed that, and committed this, with some further cosmetic
changes. I made the formatting of the help message more like psql's
help message, including adjusting pgbench to start the description of
each option in the same column that psql does. This got rid of a lot
of line breaks and IMHO makes the output of pgbench --help quite a bit
more readable. I made stylistic adjustments to the documentation
portion of the patch as well, again to match the markup used for psql.

In help messages:

+ " -s NUM, --scale NUM scaling factor\n"

This should be "-s, --scale=NUM" for the sake of consistency with other
options.

Regards,

--
Fujii Masao

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#16Robert Haas
robertmhaas@gmail.com
In reply to: Fujii Masao (#15)
Re: [PATCH] add long options to pgbench (submission 1)

On Thu, Jun 27, 2013 at 10:24 AM, Fujii Masao <masao.fujii@gmail.com> wrote:

On Thu, Jun 27, 2013 at 10:02 PM, Robert Haas <robertmhaas@gmail.com> wrote:

On Tue, Jun 25, 2013 at 3:09 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:

I think --quiet-log should be spelled --quiet.

ISTM that --quiet usually means "not verbose on stdout", so I added log
because this was specific to the log output, and that there may be a need
for a --quiet option for stdout at some time.

The output that is quieted by -q is not the log output produced by
--log; it's the regular progress output on stdout/stderr.

So I changed that, and committed this, with some further cosmetic
changes. I made the formatting of the help message more like psql's
help message, including adjusting pgbench to start the description of
each option in the same column that psql does. This got rid of a lot
of line breaks and IMHO makes the output of pgbench --help quite a bit
more readable. I made stylistic adjustments to the documentation
portion of the patch as well, again to match the markup used for psql.

In help messages:

+ " -s NUM, --scale NUM scaling factor\n"

This should be "-s, --scale=NUM" for the sake of consistency with other
options.

Woops, missed that one. Fixed, thanks.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#17Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Robert Haas (#14)
Re: [PATCH] add long options to pgbench (submission 1)

[...] So I changed that, and committed this, with some further cosmetic
changes. [...]

Thanks for the commit & the style improvements.

For the text formatting, I tried to keep the screen width under 80
characters, because if the line is too wide it is harder to read as the
eye may loose the alignment. But being homogeneous with other commands is
fine with me as well.

--
Fabien.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#18Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Fabien COELHO (#17)
Re: [PATCH] add long options to pgbench (submission 1)

Fabien COELHO escribi�:

For the text formatting, I tried to keep the screen width under 80
characters, because if the line is too wide it is harder to read as
the eye may loose the alignment. But being homogeneous with other
commands is fine with me as well.

The format chosen by Robert fits in 80 columns and looks very good to
me. Thanks to both.

--
�lvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers