提交 79cddb18 编写于 作者: R Robert Haas

pgbench: Add long options for all existing short options.

Fabien Coelho, reviewed by Fabrízio de Royes Mello, with some further
changes by me
上级 a03ae56e
...@@ -329,46 +329,43 @@ usage(void) ...@@ -329,46 +329,43 @@ usage(void)
"Usage:\n" "Usage:\n"
" %s [OPTION]... [DBNAME]\n" " %s [OPTION]... [DBNAME]\n"
"\nInitialization options:\n" "\nInitialization options:\n"
" -i invokes initialization mode\n" " -i, --initialize invokes initialization mode\n"
" -F NUM fill factor\n" " -F, --fillfactor=NUM set fill factor\n"
" -n do not run VACUUM after initialization\n" " -n, --no-vacuum do not run VACUUM after initialization\n"
" -q quiet logging (one message each 5 seconds)\n" " -q, --quiet quiet logging (one message each 5 seconds)\n"
" -s NUM scaling factor\n" " -s NUM, --scale NUM scaling factor\n"
" --foreign-keys\n" " --foreign-keys create foreign key constraints between tables\n"
" create foreign key constraints between tables\n"
" --index-tablespace=TABLESPACE\n" " --index-tablespace=TABLESPACE\n"
" create indexes in the specified tablespace\n" " create indexes in the specified tablespace\n"
" --tablespace=TABLESPACE\n" " --tablespace=TABLESPACE create tables in the specified tablespace\n"
" create tables in the specified tablespace\n" " --unlogged-tables create tables as unlogged tables\n"
" --unlogged-tables\n"
" create tables as unlogged tables\n"
"\nBenchmarking options:\n" "\nBenchmarking options:\n"
" -c NUM number of concurrent database clients (default: 1)\n" " -c, --client=NUM number of concurrent database clients (default: 1)\n"
" -C establish new connection for each transaction\n" " -C, --connect establish new connection for each transaction\n"
" -D VARNAME=VALUE\n" " -D, --define=VARNAME=VALUE\n"
" define variable for use by custom script\n" " define variable for use by custom script\n"
" -f FILENAME read transaction script from FILENAME\n" " -f, --file=FILENAME read transaction script from FILENAME\n"
" -j NUM number of threads (default: 1)\n" " -j, --jobs=NUM number of threads (default: 1)\n"
" -l write transaction times to log file\n" " -l, --log write transaction times to log file\n"
" -M simple|extended|prepared\n" " -M, --protocol=simple|extended|prepared\n"
" protocol for submitting queries to server (default: simple)\n" " protocol for submitting queries "
" -n do not run VACUUM before tests\n" "(default: simple)\n"
" -N do not update tables \"pgbench_tellers\" and \"pgbench_branches\"\n" " -n, --no-vacuum do not run VACUUM before tests\n"
" -r report average latency per command\n" " -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n"
" -s NUM report this scale factor in output\n" " -r, --report-latencies report average latency per command\n"
" -S perform SELECT-only transactions\n" " -s, --scale=NUM report this scale factor in output\n"
" -t NUM number of transactions each client runs (default: 10)\n" " -S, --select-only perform SELECT-only transactions\n"
" -T NUM duration of benchmark test in seconds\n" " -t, --transactions number of transactions each client runs "
" -v vacuum all four standard tables before tests\n" "(default: 10)\n"
" --aggregate-interval=NUM\n" " -T, --time=NUM duration of benchmark test in seconds\n"
" aggregate data over NUM seconds\n" " -v, --vacuum-all vacuum all four standard tables before tests\n"
" --sampling-rate=NUM\n" " --aggregate-interval=NUM aggregate data over NUM seconds\n"
" fraction of transactions to log (e.g. 0.01 for 1%% sample)\n" " --sampling-rate=NUM fraction of transactions to log (e.g. 0.01 for 1%%)\n"
"\nCommon options:\n" "\nCommon options:\n"
" -d print debugging output\n" " -d, --debug print debugging output\n"
" -h HOSTNAME database server host or socket directory\n" " -h, --host=HOSTNAME database server host or socket directory\n"
" -p PORT database server port number\n" " -p, --port=PORT database server port number\n"
" -U USERNAME connect as specified database user\n" " -U, --username=USERNAME connect as specified database user\n"
" -V, --version output version information, then exit\n" " -V, --version output version information, then exit\n"
" -?, --help show this help, then exit\n" " -?, --help show this help, then exit\n"
"\n" "\n"
...@@ -2109,6 +2106,30 @@ int ...@@ -2109,6 +2106,30 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
static struct option long_options[] = { 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", 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}, {"foreign-keys", no_argument, &foreign_keys, 1},
{"index-tablespace", required_argument, NULL, 3}, {"index-tablespace", required_argument, NULL, 3},
{"tablespace", required_argument, NULL, 2}, {"tablespace", required_argument, NULL, 2},
......
...@@ -150,6 +150,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -150,6 +150,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-i</option></term> <term><option>-i</option></term>
<term><option>--initialize</option></term>
<listitem> <listitem>
<para> <para>
Required to invoke initialization mode. Required to invoke initialization mode.
...@@ -159,6 +160,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -159,6 +160,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-F</option> <replaceable>fillfactor</></term> <term><option>-F</option> <replaceable>fillfactor</></term>
<term><option>--fillfactor=</option><replaceable>fillfactor</></term>
<listitem> <listitem>
<para> <para>
Create the <structname>pgbench_accounts</>, Create the <structname>pgbench_accounts</>,
...@@ -171,6 +173,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -171,6 +173,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-n</option></term> <term><option>-n</option></term>
<term><option>--no-vacuum</option></term>
<listitem> <listitem>
<para> <para>
Perform no vacuuming after initialization. Perform no vacuuming after initialization.
...@@ -180,6 +183,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -180,6 +183,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-q</option></term> <term><option>-q</option></term>
<term><option>--quiet</option></term>
<listitem> <listitem>
<para> <para>
Switch logging to quiet mode, producing only one progress message per 5 Switch logging to quiet mode, producing only one progress message per 5
...@@ -191,6 +195,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -191,6 +195,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-s</option> <replaceable>scale_factor</></term> <term><option>-s</option> <replaceable>scale_factor</></term>
<term><option>--scale=</option><replaceable>scale_factor</></term>
<listitem> <listitem>
<para> <para>
Multiply the number of rows generated by the scale factor. Multiply the number of rows generated by the scale factor.
...@@ -259,6 +264,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -259,6 +264,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-c</option> <replaceable>clients</></term> <term><option>-c</option> <replaceable>clients</></term>
<term><option>--client=</option><replaceable>clients</></term>
<listitem> <listitem>
<para> <para>
Number of clients simulated, that is, number of concurrent database Number of clients simulated, that is, number of concurrent database
...@@ -269,6 +275,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -269,6 +275,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-C</option></term> <term><option>-C</option></term>
<term><option>--connect</option></term>
<listitem> <listitem>
<para> <para>
Establish a new connection for each transaction, rather than Establish a new connection for each transaction, rather than
...@@ -280,6 +287,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -280,6 +287,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-d</option></term> <term><option>-d</option></term>
<term><option>--debug</option></term>
<listitem> <listitem>
<para> <para>
Print debugging output. Print debugging output.
...@@ -289,6 +297,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -289,6 +297,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-D</option> <replaceable>varname</><literal>=</><replaceable>value</></term> <term><option>-D</option> <replaceable>varname</><literal>=</><replaceable>value</></term>
<term><option>--define=</option><replaceable>varname</><literal>=</><replaceable>value</></term>
<listitem> <listitem>
<para> <para>
Define a variable for use by a custom script (see below). Define a variable for use by a custom script (see below).
...@@ -299,6 +308,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -299,6 +308,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-f</option> <replaceable>filename</></term> <term><option>-f</option> <replaceable>filename</></term>
<term><option>--file=</option><replaceable>filename</></term>
<listitem> <listitem>
<para> <para>
Read transaction script from <replaceable>filename</>. Read transaction script from <replaceable>filename</>.
...@@ -311,6 +321,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -311,6 +321,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-j</option> <replaceable>threads</></term> <term><option>-j</option> <replaceable>threads</></term>
<term><option>--jobs=</option><replaceable>threads</></term>
<listitem> <listitem>
<para> <para>
Number of worker threads within <application>pgbench</application>. Number of worker threads within <application>pgbench</application>.
...@@ -324,6 +335,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -324,6 +335,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-l</option></term> <term><option>-l</option></term>
<term><option>--log</option></term>
<listitem> <listitem>
<para> <para>
Write the time taken by each transaction to a log file. Write the time taken by each transaction to a log file.
...@@ -334,6 +346,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -334,6 +346,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-M</option> <replaceable>querymode</></term> <term><option>-M</option> <replaceable>querymode</></term>
<term><option>--protocol=</option><replaceable>querymode</></term>
<listitem> <listitem>
<para> <para>
Protocol to use for submitting queries to the server: Protocol to use for submitting queries to the server:
...@@ -356,6 +369,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -356,6 +369,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-n</option></term> <term><option>-n</option></term>
<term><option>--no-vacuum</option></term>
<listitem> <listitem>
<para> <para>
Perform no vacuuming before running the test. Perform no vacuuming before running the test.
...@@ -370,6 +384,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -370,6 +384,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-N</option></term> <term><option>-N</option></term>
<term><option>--skip-some-updates</option></term>
<listitem> <listitem>
<para> <para>
Do not update <structname>pgbench_tellers</> and Do not update <structname>pgbench_tellers</> and
...@@ -382,6 +397,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -382,6 +397,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-r</option></term> <term><option>-r</option></term>
<term><option>--report-latencies</option></term>
<listitem> <listitem>
<para> <para>
Report the average per-statement latency (execution time from the Report the average per-statement latency (execution time from the
...@@ -393,6 +409,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -393,6 +409,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-s</option> <replaceable>scale_factor</></term> <term><option>-s</option> <replaceable>scale_factor</></term>
<term><option>--scale=</option><replaceable>scale_factor</></term>
<listitem> <listitem>
<para> <para>
Report the specified scale factor in <application>pgbench</>'s Report the specified scale factor in <application>pgbench</>'s
...@@ -407,6 +424,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -407,6 +424,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-S</option></term> <term><option>-S</option></term>
<term><option>--select-only</option></term>
<listitem> <listitem>
<para> <para>
Perform select-only transactions instead of TPC-B-like test. Perform select-only transactions instead of TPC-B-like test.
...@@ -416,6 +434,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -416,6 +434,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-t</option> <replaceable>transactions</></term> <term><option>-t</option> <replaceable>transactions</></term>
<term><option>--transactions=</option><replaceable>transactions</></term>
<listitem> <listitem>
<para> <para>
Number of transactions each client runs. Default is 10. Number of transactions each client runs. Default is 10.
...@@ -425,6 +444,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -425,6 +444,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-T</option> <replaceable>seconds</></term> <term><option>-T</option> <replaceable>seconds</></term>
<term><option>--time=</option><replaceable>seconds</></term>
<listitem> <listitem>
<para> <para>
Run the test for this many seconds, rather than a fixed number of Run the test for this many seconds, rather than a fixed number of
...@@ -436,6 +456,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -436,6 +456,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-v</option></term> <term><option>-v</option></term>
<term><option>--vacuum-all</option></term>
<listitem> <listitem>
<para> <para>
Vacuum all four standard tables before running the test. Vacuum all four standard tables before running the test.
...@@ -495,6 +516,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -495,6 +516,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-h</option> <replaceable>hostname</></term> <term><option>-h</option> <replaceable>hostname</></term>
<term><option>--host=</option><replaceable>hostname</></term>
<listitem> <listitem>
<para> <para>
The database server's host name The database server's host name
...@@ -504,6 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -504,6 +526,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-p</option> <replaceable>port</></term> <term><option>-p</option> <replaceable>port</></term>
<term><option>--port=</option><replaceable>port</></term>
<listitem> <listitem>
<para> <para>
The database server's port number The database server's port number
...@@ -513,6 +536,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</> ...@@ -513,6 +536,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
<varlistentry> <varlistentry>
<term><option>-U</option> <replaceable>login</></term> <term><option>-U</option> <replaceable>login</></term>
<term><option>--username=</option><replaceable>login</></term>
<listitem> <listitem>
<para> <para>
The user name to connect as The user name to connect as
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册