バージョンごとのドキュメント一覧

pgbench

pgbench <refpurpose>run a benchmark test on <productname>PostgreSQL</productname></refpurpose> PostgreSQLに対してベンチマーク試験を行う

概要

pgbench -i [option...] [dbname]

pgbench [option...] [dbname]

説明

<title>Description</title>

<application>pgbench</application> is a simple program for running benchmark tests on <productname>PostgreSQL</productname>. It runs the same sequence of SQL commands over and over, possibly in multiple concurrent database sessions, and then calculates the average transaction rate (transactions per second). By default, <application>pgbench</application> tests a scenario that is loosely based on TPC-B, involving five <command>SELECT</command>, <command>UPDATE</command>, and <command>INSERT</command> commands per transaction. However, it is easy to test other cases by writing your own transaction script files. pgbenchPostgreSQL上でベンチマーク試験を行う単純なプログラムです。 これは同一のSQLコマンドの並びを何度も実行します。複数の同時実行データベースセッションで実行することもできます。 そして、トランザクションの速度(1秒当たりのトランザクション数)の平均を計算します。 デフォルトでpgbenchは、1トランザクション当たり5つのSELECTUPDATEINSERTコマンドを含むおおよそTPC-Bに基いたシナリオを試験します。 しかし、独自のトランザクションスクリプトファイルを作成することで他の試験ケースを簡単に実行することができます。

Typical output from <application>pgbench</application> looks like: pgbenchの典型的な出力を以下に示します。

transaction type: <builtin: TPC-B (sort of)>
scaling factor: 10
query mode: simple
number of clients: 10
number of threads: 1
maximum number of tries: 1
number of transactions per client: 1000
number of transactions actually processed: 10000/10000
number of failed transactions: 0 (0.000%)
latency average = 11.013 ms
latency stddev = 7.351 ms
initial connection time = 45.758 ms
tps = 896.967014 (without initial connection time)

The first seven lines report some of the most important parameter settings. The sixth line reports the maximum number of tries for transactions with serialization or deadlock errors (see <xref linkend="failures-and-retries"/> for more information). The eighth line reports the number of transactions completed and intended (the latter being just the product of number of clients and number of transactions per client); these will be equal unless the run failed before completion or some SQL command(s) failed. (In <option>-T</option> mode, only the actual number of transactions is printed.) The next line reports the number of failed transactions due to serialization or deadlock errors (see <xref linkend="failures-and-retries"/> for more information). The last line reports the number of transactions per second. 最初の7行はいくつかの最重要パラメータの設定を表示しています。 6行目では、直列化エラーまたはデッドロックエラーのあるトランザクションの最大試行回数がレポートされます(詳細は直列化の失敗/デットロック再試行を参照してください)。 8行目では、完了トランザクション数と予定したトランザクション数がレポートされます(後者は単なるクライアント数とクライアント毎のトランザクション数の積算結果です。) これらは、完了前に実行が失敗した場合や一部のSQLコマンドが失敗した場合を除いて等しくなります(-Tモードでは、実際のトランザクション数のみが出力されます)。 次の行では、直列化エラーまたはデッドロックエラーが原因で失敗したトランザクション数がレポートされます(直列化の失敗/デットロック再試行を参照してください)。 最後の行は1秒当たりのトランザクション数を示します。

The default TPC-B-like transaction test requires specific tables to be set up beforehand. <application>pgbench</application> should be invoked with the <option>-i</option> (initialize) option to create and populate these tables. (When you are testing a custom script, you don't need this step, but will instead need to do whatever setup your test needs.) Initialization looks like: デフォルトのTPC-Bと似たトランザクション試験では、あらかじめ設定する特定のテーブルが必要です。 これらのテーブルを作成し、データを投入するためには、-i(初期化)オプションを付けてpgbenchを呼び出さなければなりません。 (独自スクリプトを試験する場合、この手順は必要ありません。 しかし代わりに試験に必要な何らかの設定を行わなければならないでしょう。) 初期化は以下のようになります。

pgbench -i [ other-options ] dbname

where <replaceable>dbname</replaceable> is the name of the already-created database to test in. (You may also need <option>-h</option>, <option>-p</option>, and/or <option>-U</option> options to specify how to connect to the database server.) ここでdbnameは試験用に前もって作成されたデータベースの名前です。 (またデータベースサーバの接続方法を指定するために、-h-p-Uが必要になるかもしれません。)

注意

<literal>pgbench -i</literal> creates four tables <structname>pgbench_accounts</structname>, <structname>pgbench_branches</structname>, <structname>pgbench_history</structname>, and <structname>pgbench_tellers</structname>, destroying any existing tables of these names. Be very careful to use another database if you have tables having these names! pgbench -iは4つのテーブルpgbench_accountspgbench_branchespgbench_historypgbench_tellersを作成します。 もしあればこうした名前のテーブルは破壊されます。 もし同じ名前のテーブルが存在する場合にはよく注意してください。

At the default <quote>scale factor</quote> of 1, the tables initially contain this many rows: デフォルトの倍率の1では、テーブルは初期状態で以下の行数を含みます。

table                   # of rows
---------------------------------
pgbench_branches        1
pgbench_tellers         10
pgbench_accounts        100000
pgbench_history         0

You can (and, for most purposes, probably should) increase the number of rows by using the <option>-s</option> (scale factor) option. The <option>-F</option> (fillfactor) option might also be used at this point. -s(倍率)オプションを使用して行数を増加させることができます(また、ほとんどの目的ではおそらく増加させるべきです)。 また、-F (fillfactor)オプションをここで使用しても構いません。

Once you have done the necessary setup, you can run your benchmark with a command that doesn't include <option>-i</option>, that is 一度この必要な設定を行った後、以下のように-iを持たないコマンドでベンチマークを行うことができます。

pgbench [ options ] dbname

In nearly all cases, you'll need some options to make a useful test. The most important options are <option>-c</option> (number of clients), <option>-t</option> (number of transactions), <option>-T</option> (time limit), and <option>-f</option> (specify a custom script file). See below for a full list. ほとんどすべての場合、有用な試験とするためにいくつかのオプションが必要になります。 最重要オプションは-c(クライアント数)、-t(トランザクション数)、-T (制限時間)、-f(独自スクリプトファイルの指定)です。 以下の全一覧を参照してください。

オプション

<title>Options</title>

The following is divided into three subsections. Different options are used during database initialization and while running benchmarks, but some options are useful in both cases. 以下では、データベース初期化時に使用されるオプション、ベンチマーク実行時に使用されるオプション、どちらの場合でも使われるオプションの3つに分けて説明します。

初期化用のオプション

<title>Initialization Options</title>

<application>pgbench</application> accepts the following command-line initialization arguments: pgbenchは以下の初期化用のコマンドライン引数を受け付けます。

dbname #

Specifies the name of the database to test in. If this is not specified, the environment variable <envar>PGDATABASE</envar> is used. If that is not set, the user name specified for the connection is used. 試験するデータベースの名前を指定します。 これが指定されていない場合、環境変数PGDATABASEが使用されます。 この変数も設定されていない場合は、接続のために指定されたユーザ名が使用されます。

-i
--initialize #

Required to invoke initialization mode. 初期化モードを呼び出すために必要です。

-I init_steps
--init-steps=init_steps #

Perform just a selected set of the normal initialization steps. <replaceable>init_steps</replaceable> specifies the initialization steps to be performed, using one character per step. Each step is invoked in the specified order. The default is <literal>dtgvp</literal>. The available steps are: 標準の初期化ステップの内、選択したものだけを実行します。 init_stepsでは、各ステップ毎に1文字を使って、実行する初期化ステップを指定します。 各ステップは指定した順で実行されます。 デフォルトはdtgvpです。 有効なステップは以下の通りです。

d (Drop) #

Drop any existing <application>pgbench</application> tables. 既存のpgbenchのテーブルを全て削除します。

t (create Tables) #

Create the tables used by the standard <application>pgbench</application> scenario, namely <structname>pgbench_accounts</structname>, <structname>pgbench_branches</structname>, <structname>pgbench_history</structname>, and <structname>pgbench_tellers</structname>. 標準のpgbenchシナリオで使われるテーブル、すなわちpgbench_accountspgbench_branchespgbench_historyおよびpgbench_tellersを作成します。

gまたはG (Generate data, クライアント側、またはサーバ側) #

Generate data and load it into the standard tables, replacing any data already present. データを生成し、既存データを置き換えて、標準の各テーブルに読み込みます。

With <literal>g</literal> (client-side data generation), data is generated in <command>pgbench</command> client and then sent to the server. This uses the client/server bandwidth extensively through a <command>COPY</command>. <command>pgbench</command> uses the FREEZE option with version 14 or later of <productname>PostgreSQL</productname> to speed up subsequent <command>VACUUM</command>, unless partitions are enabled. Using <literal>g</literal> causes logging to print one message every 100,000 rows while generating data for the <structname>pgbench_accounts</structname> table. g(クライアント側データ生成)は、データはpgbenchクライアントで生成されてからサーバに送られます。 これはCOPYでクライアント/サーバの帯域を大きく使います。 pgbenchは、バージョン14またはそれ以降のPostgreSQLを持つフリーズオプションを使用して、パーティションが有効になっていない限り、その後のVACUUMを高速化します。 gを使うと、pgbench_accountsテーブルのためにデータを生成する間、100,000行毎にメッセージを1つログ出力するようになります。

With <literal>G</literal> (server-side data generation), only small queries are sent from the <command>pgbench</command> client and then data is actually generated in the server. No significant bandwidth is required for this variant, but the server will do more work. Using <literal>G</literal> causes logging not to print any progress message while generating data. G(サーバ側データ生成)では、小さな問い合わせだけがpgbenchクライアントから送られ、データは実際にはサーバで生成されます。 こちらは帯域を著しく要求することはありませんが、サーバが、より多くの作業をすることになります。 Gを使うと、データを生成する間は進捗メッセージをログ出力しなくなります。

The default initialization behavior uses client-side data generation (equivalent to <literal>g</literal>). デフォルトの初期化動作は、クライアント側のデータ生成(gと同じ)を使います。

v (Vacuum) #

Invoke <command>VACUUM</command> on the standard tables. 標準の各テーブルに対してVACUUMを実行します。

p (create Primary keys) #

Create primary key indexes on the standard tables. 標準の各テーブルにプライマリキーインデックスを作成します。

f (create Foreign keys) #

Create foreign key constraints between the standard tables. (Note that this step is not performed by default.) 標準のテーブル間に外部キー制約を作成します。 (このステップはデフォルトでは実行されないことに注意してください)

-F fillfactor
--fillfactor=fillfactor #

Create the <structname>pgbench_accounts</structname>, <structname>pgbench_tellers</structname> and <structname>pgbench_branches</structname> tables with the given fillfactor. Default is 100. 指定したfillfactorでpgbench_accountspgbench_tellerspgbench_branchesテーブルを作成します。 デフォルトは100です。

-n
--no-vacuum #

Perform no vacuuming during initialization. (This option suppresses the <literal>v</literal> initialization step, even if it was specified in <option>-I</option>.) 初期化でバキュームを実行しません。 (このオプションは-Iで指定されていたとしても初期化ステップvを抑止します。)

-q
--quiet #

Switch logging to quiet mode, producing only one progress message per 5 seconds. The default logging prints one message each 100,000 rows, which often outputs many lines per second (especially on good hardware). ログ処理を、5秒に1つの進行メッセージのみを生成する静寂モードに切り替えます。 デフォルトのログ処理では、100,000行毎にメッセージを1つ出力し、(特に優れたハードウェアでは)1秒当たりに多くのメッセージを出力します。

This setting has no effect if <literal>G</literal> is specified in <option>-I</option>. -Iの中でGが指定されていれば、この設定は影響しません。

-s scale_factor
--scale=scale_factor #

Multiply the number of rows generated by the scale factor. For example, <literal>-s 100</literal> will create 10,000,000 rows in the <structname>pgbench_accounts</structname> table. Default is 1. When the scale is 20,000 or larger, the columns used to hold account identifiers (<structfield>aid</structfield> columns) will switch to using larger integers (<type>bigint</type>), in order to be big enough to hold the range of account identifiers. この倍率で生成される行数を積算します。 例えば、-s 100pgbench_accountsテーブルに10,000,000行を生成することを意味します。 デフォルトは1です。 この倍率が20000以上になると、アカウント識別子の範囲を保持できる程度に大きくなるように、アカウント識別子を保持するために使用される列(aid列)はより大きな整数(bigint)を使用するように切り替わります。

--foreign-keys #

Create foreign key constraints between the standard tables. (This option adds the <literal>f</literal> step to the initialization step sequence, if it is not already present.) 標準テーブル間で外部キー制約を作成します。 (このオプションは初期化ステップの並びに、もし無かったならfステップを追加します。)

--index-tablespace=index_tablespace #

Create indexes in the specified tablespace, rather than the default tablespace. デフォルトのテーブル空間ではなく、指定したテーブル空間の中にインデックスを作成します。

--partition-method=NAME #

Create a partitioned <literal>pgbench_accounts</literal> table with <replaceable>NAME</replaceable> method. Expected values are <literal>range</literal> or <literal>hash</literal>. This option requires that <option>&#45;-partitions</option> is set to non-zero. If unspecified, default is <literal>range</literal>. NAMEメソッドでパーティション化されたpgbench_accountsテーブルを作成します。 期待される値はrangeまたはhashです。 このオプションは--partitionsが0でない値に設定されていることを要求します。 指定されなければ、デフォルトはrangeです。

--partitions=NUM #

Create a partitioned <literal>pgbench_accounts</literal> table with <replaceable>NUM</replaceable> partitions of nearly equal size for the scaled number of accounts. Default is <literal>0</literal>, meaning no partitioning. アカウントの数に比例したほぼ等しい大きさのNUM個のパーティションにパーティション化されたpgbench_accountsテーブルを作成します。 デフォルトは0で、パーティション化しないことを意味します。

--tablespace=tablespace #

Create tables in the specified tablespace, rather than the default tablespace. デフォルトのテーブル空間ではなく、指定したテーブル空間の中にテーブルを作成します。

--unlogged-tables #

Create all tables as unlogged tables, rather than permanent tables. 永続テーブルではなくログを取らないテーブルとしてテーブルを作成します。

ベンチマーク用オプション

<title>Benchmarking Options</title>

<application>pgbench</application> accepts the following command-line benchmarking arguments: pgbenchは以下のベンチマーク用コマンドライン引数を受け付けます。

-b scriptname[@weight]
--builtin=scriptname[@weight] #

Add the specified built-in script to the list of scripts to be executed. Available built-in scripts are: <literal>tpcb-like</literal>, <literal>simple-update</literal> and <literal>select-only</literal>. Unambiguous prefixes of built-in names are accepted. With the special name <literal>list</literal>, show the list of built-in scripts and exit immediately. 指定の組み込みスクリプトを実行するスクリプトのリストに追加します。 利用可能な組み込みのスクリプトは、tpcb-likesimple-updateselect-onlyです。 組み込みの名前の曖昧な接頭辞も受け付けられます。 特別な名前listを使うと、組み込みスクリプトのリストを表示して、即座に終了します。

Optionally, write an integer weight after <literal>@</literal> to adjust the probability of selecting this script versus other ones. The default weight is 1. See below for details. オプションで、@の後に整数のweight(重み)を書くことで、他のスクリプトと比較してそのスクリプトが選ばれる確率を調整することができます。 デフォルトの重みは1です。 詳細は以下を参照してください。

-c clients
--client=clients #

Number of clients simulated, that is, number of concurrent database sessions. Default is 1. 模擬するクライアント数、つまり、同時に実行されるデータベースセッション数です。 デフォルトは1です。

-C
--connect #

Establish a new connection for each transaction, rather than doing it just once per client session. This is useful to measure the connection overhead. 各クライアントセッションが一度だけ接続を確立するのではなく、各トランザクションが新しい接続を確立します。 これは接続オーバーヘッドを測定する場合に有用です。

-d
--debug #

Print debugging output. デバッグ用出力を表示します。

-D varname=value
--define=varname=value #

Define a variable for use by a custom script (see below). Multiple <option>-D</option> options are allowed. 独自スクリプト(後述)で使用される変数を定義します。 複数の-Dオプションを使用することができます。

-f filename[@weight]
--file=filename[@weight] #

Add a transaction script read from <replaceable>filename</replaceable> to the list of scripts to be executed. filenameから読み取ったトランザクションスクリプトを実行されるスクリプトのリストに追加します。

Optionally, write an integer weight after <literal>@</literal> to adjust the probability of selecting this script versus other ones. The default weight is 1. (To use a script file name that includes an <literal>@</literal> character, append a weight so that there is no ambiguity, for example <literal>filen@me@1</literal>.) See below for details. オプションで、@の後に整数のweight(重み)をつけることで、他のスクリプトと比較してそのスクリプトが選ばれる確率を調整することができます。 デフォルトの重みは1です。 (@文字を含むスクリプトファイル名を使用するには、 filen@me@1 のように曖昧さがないように重みを付けます。) 詳細は以下を参照してください。

-j threads
--jobs=threads #

Number of worker threads within <application>pgbench</application>. Using more than one thread can be helpful on multi-CPU machines. Clients are distributed as evenly as possible among available threads. Default is 1. pgbench内のワーカースレッド数です。 複数のスレッドを使用することはマルチCPUマシンで有用になります。 クライアントは利用可能なスレッドの間でできる限り均等に分散されます。 デフォルトは1です。

-l
--log #

Write information about each transaction to a log file. See below for details. 各トランザクションに関する情報をログファイルに書き出します。 詳細は以下を参照してください。

-L limit
--latency-limit=limit #

Transactions that last more than <replaceable>limit</replaceable> milliseconds are counted and reported separately, as <firstterm>late</firstterm>. limitミリ秒以上続くトランザクションが計数され、別途遅いトランザクションとして報告されます。

When throttling is used (<option>&#45;-rate=...</option>), transactions that lag behind schedule by more than <replaceable>limit</replaceable> ms, and thus have no hope of meeting the latency limit, are not sent to the server at all. They are counted and reported separately as <firstterm>skipped</firstterm>. 制限が使用されると(--rate=...)、limitミリ秒以上遅延がスケジュールされたトランザクションは遅延制限を満たす可能性がないため、サーバに送信されることは決してありません。 これらのトランザクションは計数され、別途スキップされたとして報告されます。

When the <option>&#45;-max-tries</option> option is used, a transaction which fails due to a serialization anomaly or from a deadlock will not be retried if the total time of all its tries is greater than <replaceable>limit</replaceable> ms. To limit only the time of tries and not their number, use <literal>&#45;-max-tries=0</literal>. By default, the option <option>&#45;-max-tries</option> is set to 1 and transactions with serialization/deadlock errors are not retried. See <xref linkend="failures-and-retries"/> for more information about retrying such transactions. --max-triesオプションが使用されている場合、直列化異常またはデッドロックのために失敗したトランザクションは、すべての試行の合計時間がlimitより大きい場合、再試行されません。 試行回数ではなく試行時間のみを制限するには、--max-tries=0を使用します。 デフォルトでは、--max-triesオプションは1に設定されており、直列化エラー/デッドロックエラーのあるトランザクションは再試行されません。 このようなトランザクションの再試行の詳細は直列化の失敗/デットロック再試行を参照してください。

-M querymode
--protocol=querymode #

Protocol to use for submitting queries to the server: サーバへ問い合わせを送信するために使用するプロトコルです。

  • <para><literal>simple</literal>: use simple query protocol.</para>

    simple: 簡易問い合わせプロトコルを使用します。

  • <para><literal>extended</literal>: use extended query protocol.</para>

    extended: 拡張問い合わせプロトコルを使用します。

  • <para><literal>prepared</literal>: use extended query protocol with prepared statements.</para>

    prepared: プリペアドステートメントを伴う拡張問い合わせプロトコルを使用します。

In the <literal>prepared</literal> mode, <application>pgbench</application> reuses the parse analysis result starting from the second query iteration, so <application>pgbench</application> runs faster than in other modes. preparedモードでは、pgbenchは問い合わせの2回目の繰り返しからは構文解析結果を再利用しますので、pgbenchは他のモードよりも速く動作します。

The default is simple query protocol. (See <xref linkend="protocol"/> for more information.) デフォルトは簡易問い合わせプロトコルです。 (詳しい情報は第55章を参照してください)

-n
--no-vacuum #

Perform no vacuuming before running the test. This option is <emphasis>necessary</emphasis> if you are running a custom test scenario that does not include the standard tables <structname>pgbench_accounts</structname>, <structname>pgbench_branches</structname>, <structname>pgbench_history</structname>, and <structname>pgbench_tellers</structname>. 試験を実行する前にバキュームを行いません。 pgbench_accountspgbench_branchespgbench_historypgbench_tellers標準テーブルを含まない独自試験シナリオを実行する場合、このオプションは必要です。

-N
--skip-some-updates #

Run built-in simple-update script. Shorthand for <option>-b simple-update</option>. 組み込みのsimple-update(単純な更新)のスクリプトを実行します。 -b simple-updateの短縮形です。

-P sec
--progress=sec #

Show progress report every <replaceable>sec</replaceable> seconds. The report includes the time since the beginning of the run, the TPS since the last report, and the transaction latency average, standard deviation, and the number of failed transactions since the last report. Under throttling (<option>-R</option>), the latency is computed with respect to the transaction scheduled start time, not the actual transaction beginning time, thus it also includes the average schedule lag time. When <option>&#45;-max-tries</option> is used to enable transaction retries after serialization/deadlock errors, the report includes the number of retried transactions and the sum of all retries. sec秒毎の進捗レポートを表示します。 レポートには起動からの経過時間、前回レポート時からのTPS、前回レポート時からのトランザクションの平均待ち時間、標準偏差、最後のレポートからの失敗したトランザクションの数を含んでいます。 (-R)オプションによる制限下では、待ち時間はトランザクションの実開始時間ではなく、予定開始時間で算出されていますので、平均予定遅延時間が含まれています。 --max-triesを使用して直列化エラー/デッドロックエラー後のトランザクション再試行を有効にする場合、レポートには再試行されたトランザクションの数とすべての再試行の回数が含まれます。

-r
--report-per-command #

Report the following statistics for each command after the benchmark finishes: the average per-statement latency (execution time from the perspective of the client), the number of failures, and the number of retries after serialization or deadlock errors in this command. The report displays retry statistics only if the <option>&#45;-max-tries</option> option is not equal to 1. ベンチマークの終了後、各コマンドについて、文ごとの平均待機時間(クライアントから見た実行時間)、失敗回数、およびこのコマンドの直列化エラーまたはデッドロックエラー後の再試行回数の統計をレポートします。 レポートに再試行統計が表示されるのは、--max-triesオプションが1以外の場合のみです。

-R rate
--rate=rate #

Execute transactions targeting the specified rate instead of running as fast as possible (the default). The rate is given in transactions per second. If the targeted rate is above the maximum possible rate, the rate limit won't impact the results. トランザクションを可能な限り高速(デフォルト)で実行するのではなく、指定された目標レートで実行します。 レートは1秒あたりのトランザクション数で与えられます。目標レートが実施可能な最大レートを越えている場合、レート制限は結果に影響を与えません。

The rate is targeted by starting transactions along a Poisson-distributed schedule time line. The expected start time schedule moves forward based on when the client first started, not when the previous transaction ended. That approach means that when transactions go past their original scheduled end time, it is possible for later ones to catch up again. レートはトランザクションの開始予定タイムラインがポアソン分布に沿う事を目標としています。 期待される開始時刻の予定は、前トランザクションの終了時ではなくクライアントの初期起動時に基づいて動かします。 このアプローチはトランザクションがオリジナルの終了予定時刻を過ぎた場合でも、後でまた追い付けることを意味します。

When throttling is active, the transaction latency reported at the end of the run is calculated from the scheduled start times, so it includes the time each transaction had to wait for the previous transaction to finish. The wait time is called the schedule lag time, and its average and maximum are also reported separately. The transaction latency with respect to the actual transaction start time, i.e., the time spent executing the transaction in the database, can be computed by subtracting the schedule lag time from the reported latency. 制限がアクティブになると、実行終了時に報告されるトランザクション待ち時間は、予定開始時刻から計算されるので、 各トランザクションが前トランザクションの終了を待たねばならなかった時間を含んでいます。 この待ち時間はスケジュールラグタイムと呼ばれ、平均と最大値も別々に報告されます。 実トランザクション開始時刻についてのトランザクション待ち時間、つまりデータベース内でトランザクションの実行に要した時間は、報告された待ち時間からスケジュールラグタイムを減算することで算出することができます。

If <option>&#45;-latency-limit</option> is used together with <option>&#45;-rate</option>, a transaction can lag behind so much that it is already over the latency limit when the previous transaction ends, because the latency is calculated from the scheduled start time. Such transactions are not sent to the server, but are skipped altogether and counted separately. --latency-limit--rateと一緒に指定された場合、トランザクションは、先行するトランザクションが終了した際にすでに遅延制限を超えていて、非常に遅れてしまうことがあり得ます。 そのようなトランザクションはサーバに送信さることなくスキップされ、別途カウントされます。

A high schedule lag time is an indication that the system cannot process transactions at the specified rate, with the chosen number of clients and threads. When the average transaction execution time is longer than the scheduled interval between each transaction, each successive transaction will fall further behind, and the schedule lag time will keep increasing the longer the test run is. When that happens, you will have to reduce the specified transaction rate. スケジュールラグタイムの高い値は、システムが選択されたクライアント数とスレッド数で、指定されたレートでトランザクションを処理できなかったことを示しています。 トランザクションの平均実行時間が各トランザクション間で予定されていた間隔より長い場合、各逐次トランザクションは更に遅くなり、 スケジュールラグタイムはテスト実行がより長く増加し続けます。 これが起こる場合、指定トランザクションレートを減らす必要があります。

-s scale_factor
--scale=scale_factor #

Report the specified scale factor in <application>pgbench</application>'s output. With the built-in tests, this is not necessary; the correct scale factor will be detected by counting the number of rows in the <structname>pgbench_branches</structname> table. However, when testing only custom benchmarks (<option>-f</option> option), the scale factor will be reported as 1 unless this option is used. pgbenchの出力で指定した倍率をレポートします。 これは組み込みの試験では必要ありません。 正確な倍率がpgbench_branchesテーブルの行数を数えることで検出されます。 しかし、独自ベンチマーク(-fオプション)のみを試験している場合、このオプションを使用しない限り、倍率は1として報告されます。

-S
--select-only #

Run built-in select-only script. Shorthand for <option>-b select-only</option>. 組み込みのselect-only(SELECTのみ)のスクリプトを実行します。 -b select-onlyの短縮形です。

-t transactions
--transactions=transactions #

Number of transactions each client runs. Default is 10. 各クライアントが実行するトランザクション数です。 デフォルトは10です。

-T seconds
--time=seconds #

Run the test for this many seconds, rather than a fixed number of transactions per client. <option>-t</option> and <option>-T</option> are mutually exclusive. クライアントあたりのトランザクション数を固定で指定するよりも長くテストを実行したい場合、ここに指定した秒数でテストを実行します。 -t-Tは互いに排他的です。

-v
--vacuum-all #

Vacuum all four standard tables before running the test. With neither <option>-n</option> nor <option>-v</option>, <application>pgbench</application> will vacuum the <structname>pgbench_tellers</structname> and <structname>pgbench_branches</structname> tables, and will truncate <structname>pgbench_history</structname>. 試験前に4つの標準テーブルすべてをバキュームします。 -n-vもなければ、pgbenchpgbench_tellerspgbench_branchesテーブルをバキュームし、pgbench_history内のデータをすべて消去します。

--aggregate-interval=seconds #

Length of aggregation interval (in seconds). May be used only with <option>-l</option> option. With this option, the log contains per-interval summary data, as described below. 集約間隔の長さ(秒単位)です。 これは-lと一緒でのみ使用できます。 このオプションを付けると、ログには以下で説明するような指定間隔単位の要約が含まれます。

--failures-detailed #

Report failures in per-transaction and aggregation logs, as well as in the main and per-script reports, grouped by the following types: トランザクションごとおよび集約ログ、メインレポートおよびスクリプトごとのレポートで、次のタイプにグループ化された失敗をレポートします。

  • <para>serialization failures;</para>

    直列化失敗

  • <para>deadlock failures;</para>

    デッドロック障害

See <xref linkend="failures-and-retries"/> for more information. 詳細については、直列化の失敗/デットロック再試行を参照してください。

--log-prefix=prefix #

Set the filename prefix for the log files created by <option>&#45;-log</option>. The default is <literal>pgbench_log</literal>. --logにより作成されるログファイルのファイル名の先頭につける文字列を設定します。 デフォルトはpgbench_logです。

--max-tries=number_of_tries #

Enable retries for transactions with serialization/deadlock errors and set the maximum number of these tries. This option can be combined with the <option>&#45;-latency-limit</option> option which limits the total time of all transaction tries; moreover, you cannot use an unlimited number of tries (<literal>&#45;-max-tries=0</literal>) without <option>&#45;-latency-limit</option> or <option>&#45;-time</option>. The default value is 1 and transactions with serialization/deadlock errors are not retried. See <xref linkend="failures-and-retries"/> for more information about retrying such transactions. 直列化エラー/デッドロックエラーのあるトランザクションの再試行を有効にし、これらの試行の最大数を設定します。 このオプションは、すべてのトランザクション試行の合計時間を制限する--latency-limitオプションと組み合せることができます。 また、--latency-limitまたは--timeを指定せずに試行回数を無制限に使用することはできません(--max-tries=0)。 デフォルト値は1で、直列化エラー/デッドロックエラーのあるトランザクションは再試行されません。 このようなトランザクションの再試行の詳細は、直列化の失敗/デットロック再試行を参照してください。

--progress-timestamp #

When showing progress (option <option>-P</option>), use a timestamp (Unix epoch) instead of the number of seconds since the beginning of the run. The unit is in seconds, with millisecond precision after the dot. This helps compare logs generated by various tools. 進捗を表示(-Pオプション)しているとき、実行開始以後の経過秒数の代わりにタイムスタンプ(Unixエポック時刻)を使用します。 単位は秒で、ドットの後にミリ秒の精度が付きます。 これは様々なツールで生成されたログを比較するのに役立つでしょう。

--random-seed=seed #

Set random generator seed. Seeds the system random number generator, which then produces a sequence of initial generator states, one for each thread. Values for <replaceable>seed</replaceable> may be: <literal>time</literal> (the default, the seed is based on the current time), <literal>rand</literal> (use a strong random source, failing if none is available), or an unsigned decimal integer value. The random generator is invoked explicitly from a pgbench script (<literal>random...</literal> functions) or implicitly (for instance option <option>&#45;-rate</option> uses it to schedule transactions). When explicitly set, the value used for seeding is shown on the terminal. Any value allowed for <replaceable>seed</replaceable> may also be provided through the environment variable <literal>PGBENCH_RANDOM_SEED</literal>. To ensure that the provided seed impacts all possible uses, put this option first or use the environment variable. ランダムジェネレータのシードを設定します。 各スレッド毎の初期ジェネレータ状態から一連の値を生成する、システム乱数ジェネレータの種となります。 seedの値は以下が可能です。 time(デフォルト、現在時刻に基づくシード)、rand(強いランダムソースを使用、使用できなければ失敗します)、あるいは符号無し整数値です。 ランダムジェネレータはpgbenchスクリプト(random...関数)から明示的に、あるいは暗黙に(例えばオプション--rateがトランザクションのスケジュールに使用します)、実行されます。 明示的に設定した場合、シードに使われる値はターミナルにあらわれます。 seedに与えることのできる値は何であれ、環境変数PGBENCH_RANDOM_SEEDを通して付与しても良いです。 設定したシードがありうる全ての実行に影響を及ぼすようにするためには、本オプションを最初に置くか、環境変数を使ってください。

Setting the seed explicitly allows to reproduce a <command>pgbench</command> run exactly, as far as random numbers are concerned. As the random state is managed per thread, this means the exact same <command>pgbench</command> run for an identical invocation if there is one client per thread and there are no external or data dependencies. From a statistical viewpoint reproducing runs exactly is a bad idea because it can hide the performance variability or improve performance unduly, e.g., by hitting the same pages as a previous run. However, it may also be of great help for debugging, for instance re-running a tricky case which leads to an error. Use wisely. 明示的にシードを設定することは、乱数に関しては、正確にpgbench実行を再現することを可能にします。 ランダム状態はスレッド毎に制御されているので、スレッド毎に一つのクライアントであり、外的な依存やデータ依存が無い場合、同一の起動に対して正確に同じpgbench実行することを意味します。 統計的観点からは、性能のばらつきを隠したり、例えば前回実行と同じページにヒットすることで不当に性能改善するので、正確な再現実行は悪い考えです。 しかしながら、例えばエラーを起こすトリッキーなケースを再実行するなど、デバッグには大きな助けとなるでしょう。 賢く使ってください。

--sampling-rate=rate #

Sampling rate, used when writing data into the log, to reduce the amount of log generated. If this option is given, only the specified fraction of transactions are logged. 1.0 means all transactions will be logged, 0.05 means only 5% of the transactions will be logged. データをログに書き出す際に使用される、生成されるログの量を減少するためのサンプリング割合です。 このオプションが指定された場合、指定された割合のトランザクションがログに残ります。 1.0はすべてのトランザクションが、0.05はトランザクションの5%のみがログに残ることを意味します。

Remember to take the sampling rate into account when processing the log file. For example, when computing TPS values, you need to multiply the numbers accordingly (e.g., with 0.01 sample rate, you'll only get 1/100 of the actual TPS). ログファイルを処理する際にはこのサンプリング割合を考慮することを忘れないでください。 例えば、TPS値を計算する際には、比例した数を掛け合わせなければなりません(例:サンプリング割合が0.01の場合実際のTPSの1/100を得るだけです。)

--show-script=scriptname #

Show the actual code of builtin script <replaceable>scriptname</replaceable> on stderr, and exit immediately. 組み込みスクリプトscriptnameの実際のコードを標準エラーに出力し、即座に終了します。

--verbose-errors #

Print messages about all errors and failures (errors without retrying) including which limit for retries was exceeded and how far it was exceeded for the serialization/deadlock failures. (Note that in this case the output can be significantly increased.). See <xref linkend="failures-and-retries"/> for more information. すべてのエラーと失敗(再試行しないエラー)に関するメッセージを表示します。 これには、どの再試行制限を超えたか、および直列化/デッドロックの失敗でどの程度超えたかが含まれます(この場合、出力が大幅に増加することに注意してください)。 詳細は直列化の失敗/デットロック再試行を参照してください。

共通オプション

<title>Common Options</title>

<application>pgbench</application> also accepts the following common command-line arguments for connection parameters: pgbenchは接続パラメータとして以下の共通コマンドライン引数も受け付けます。

-h hostname
--host=hostname #

The database server's host name データベースサーバのホスト名

-p port
--port=port #

The database server's port number データベースサーバのポート番号

-U login
--username=login #

The user name to connect as 接続ユーザ名

-V
--version #

Print the <application>pgbench</application> version and exit. pgbenchのバージョンを表示し、終了します。

-?
--help #

Show help about <application>pgbench</application> command line arguments, and exit. pgbenchのコマンドライン引数の説明を表示し、終了します。

終了ステータス

<title>Exit Status</title>

A successful run will exit with status 0. Exit status 1 indicates static problems such as invalid command-line options or internal errors which are supposed to never occur. Early errors that occur when starting benchmark such as initial connection failures also exit with status 1. Errors during the run such as database errors or problems in the script will result in exit status 2. In the latter case, <application>pgbench</application> will print partial results. 実行に成功すればステータス0で終了します。 終了ステータス1は、無効なコマンドラインオプションや発生しないと思われる内部エラーなどの静的の問題を示します。 最初のコネクションの失敗など、ベンチマークの起動時に発生する初期エラーも、終了ステータス1になります。 データベースエラーやスクリプトでの問題などの実行中のエラーは終了ステータス2になります。 後者の場合、pgbenchは部分的な結果を表示します。

環境

<title>Environment</title>
PGDATABASE
PGHOST
PGPORT
PGUSER #

Default connection parameters. デフォルトの接続パラメータです。

This utility, like most other <productname>PostgreSQL</productname> utilities, uses the environment variables supported by <application>libpq</application> (see <xref linkend="libpq-envars"/>). このユーティリティは、他のほとんどのPostgreSQLユーティリティと同様、libpqでサポートされる環境変数を使用します(34.15を参照してください)。

The environment variable <envar>PG_COLOR</envar> specifies whether to use color in diagnostic messages. Possible values are <literal>always</literal>, <literal>auto</literal> and <literal>never</literal>. 環境変数PG_COLORは診断メッセージで色を使うかどうかを指定します。 可能な値はalwaysautoneverです。

注釈

<title>Notes</title> <refsect2 id="transactions-and-scripts" xreflabel="What Is the &quot;Transaction&quot; Actually Performed in pgbench?"> <title>What Is the <quote>Transaction</quote> Actually Performed in <application>pgbench</application>?</title>

pgbenchで実際に実行されるトランザクションは何か?

<application>pgbench</application> executes test scripts chosen randomly from a specified list. The scripts may include built-in scripts specified with <option>-b</option> and user-provided scripts specified with <option>-f</option>. Each script may be given a relative weight specified after an <literal>@</literal> so as to change its selection probability. The default weight is <literal>1</literal>. Scripts with a weight of <literal>0</literal> are ignored. pgbenchは指定したリストからランダムに選択したテストスクリプトを実行します。 これには-bの組み込みスクリプトと-fのユーザ定義カスタムスクリプトが含まれることがあります。 各スクリプトには@の後に指定される相対的な重みを与えることができ、それが選ばれる確率を変更することができます。 デフォルトの重みは1です。 重みが0のスクリプトは無視されます。

The default built-in transaction script (also invoked with <option>-b tpcb-like</option>) issues seven commands per transaction over randomly chosen <literal>aid</literal>, <literal>tid</literal>, <literal>bid</literal> and <literal>delta</literal>. The scenario is inspired by the TPC-B benchmark, but is not actually TPC-B, hence the name. デフォルトの組み込みトランザクションスクリプト(-b tpcb-likeとすることでも実行されます)は、aidtidbiddeltaからランダムに選択され、トランザクション毎に7つのコマンドを発行します。 このシナリオはTPC-Bベンチマークに示唆を受けたものですが、実際にはTPC-Bではないので、この名前になっています。

  1. BEGIN;

  2. UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;

  3. SELECT abalance FROM pgbench_accounts WHERE aid = :aid;

  4. UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;

  5. UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;

  6. INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);

  7. END;

If you select the <literal>simple-update</literal> built-in (also <option>-N</option>), steps 4 and 5 aren't included in the transaction. This will avoid update contention on these tables, but it makes the test case even less like TPC-B. simple-updateの組み込みを選択した(あるいは-Nを指定した)場合、第4ステップと第5ステップはトランザクションに含まれません。 これにより、これらのテーブルに対する更新の競合を避けられますが、テストケースはさらにTPC-Bらしくなくなります。

If you select the <literal>select-only</literal> built-in (also <option>-S</option>), only the <command>SELECT</command> is issued. select-onlyの組み込みを選択した(あるいは-Sを指定した)場合、SELECTのみが発行されます。

独自スクリプト

<title>Custom Scripts</title>

<application>pgbench</application> has support for running custom benchmark scenarios by replacing the default transaction script (described above) with a transaction script read from a file (<option>-f</option> option). In this case a <quote>transaction</quote> counts as one execution of a script file. pgbenchは、ファイルから読み込んだトランザクションスクリプト(-fオプション)でデフォルトのトランザクションスクリプト(上述)を置き換えて独自のベンチマークシナリオを実行する機能をサポートします。 この場合、トランザクションはスクリプトファイルの1回の実行として数えられます。

A script file contains one or more SQL commands terminated by semicolons. Empty lines and lines beginning with <literal>&#45;-</literal> are ignored. Script files can also contain <quote>meta commands</quote>, which are interpreted by <application>pgbench</application> itself, as described below. スクリプトファイルにはセミコロンで終了するSQLコマンドが1つ以上含まれます。 空行および--から始まる行は無視されます。 スクリプトファイルの行には、pgbench自身が解釈するメタコマンド(後述)も記述することができます。

注記

Before <productname>PostgreSQL</productname> 9.6, SQL commands in script files were terminated by newlines, and so they could not be continued across lines. Now a semicolon is <emphasis>required</emphasis> to separate consecutive SQL commands (though an SQL command does not need one if it is followed by a meta command). If you need to create a script file that works with both old and new versions of <application>pgbench</application>, be sure to write each SQL command on a single line ending with a semicolon. PostgreSQLの9.6より前では、スクリプトファイル内のSQLコマンドは改行で終了しており、そのため行をまたがって継続することができませんでした。 これからは連続するSQLコマンドを区切るためにセミコロンが必要です(ただし、SQLコマンドの後にメタコマンドが続く場合は、セミコロンは必要ありません)。 pgbenchの古いバージョンと新しいバージョンの両方で動作するスクリプトを作る必要があるなら、各SQLコマンドを1行で書き、終わりにセミコロンを付けるようにしてください。

It is assumed that pgbench scripts do not contain incomplete blocks of SQL transactions. If at runtime the client reaches the end of the script without completing the last transaction block, it will be aborted. pgbenchスクリプトにはSQLトランザクションの不完全なブロックが含まれていないと想定されています。 実行時にクライアントが最後のトランザクションブロックを完了せずにスクリプトの最後に到達した場合、クライアントは中断されます。

There is a simple variable-substitution facility for script files. Variable names must consist of letters (including non-Latin letters), digits, and underscores, with the first character not being a digit. Variables can be set by the command-line <option>-D</option> option, explained above, or by the meta commands explained below. In addition to any variables preset by <option>-D</option> command-line options, there are a few variables that are preset automatically, listed in <xref linkend="pgbench-automatic-variables"/>. A value specified for these variables using <option>-D</option> takes precedence over the automatic presets. Once set, a variable's value can be inserted into an SQL command by writing <literal>:</literal><replaceable>variablename</replaceable>. When running more than one client session, each session has its own set of variables. <application>pgbench</application> supports up to 255 variable uses in one statement. スクリプトファイル向けの簡単な変数置換機能があります。 変数名は最初の文字が数字以外で文字(非ラテン文字を含む)、数字およびアンダースコアで構成されていなければなりません。 上で説明したように変数を-Dコマンドラインオプションで設定することができます。 また、後で説明するようにメタコマンドで設定することもできます。 -Dコマンドラインオプションで設定された変数の他に、表 293に記載されているように、自動的に設定される変数がいくつかあります。 -D を使ってこれらの変数に設定された値は、自動設定の値より優先されます。 一度設定すると、変数の値は、:variablenameと書かれてSQLコマンドに挿入されます。 1つ以上のクライアントセッションが実行される場合、セッション毎に独自の変数群を持ちます。 pgbenchは1つの文内で255個までの変数の利用をサポートします。

表293 pgbench Automatic Variables

変数説明
client_id クライアントセッションを識別する一意の数値(ゼロから始まる)
default_seed デフォルトでハッシュ関数や疑似ランダム置換関数で使われるシード
random_seed ランダムジェネレータのシード(-Dで上書きされていないなら)
scale 現在の倍率

Script file meta commands begin with a backslash (<literal>\</literal>) and normally extend to the end of the line, although they can be continued to additional lines by writing backslash-return. Arguments to a meta command are separated by white space. These meta commands are supported: スクリプトファイルのメタコマンドはバックスラッシュ(\)から始まり、通常は行末まで続きますが、バックスラッシュと改行を書くことで、追加の行に続けることができます。 メタコマンドへの引数は空白文字で区切られます。 以下のメタコマンドがサポートされています。

\gset [prefix] \aset [prefix] #

These commands may be used to end SQL queries, taking the place of the terminating semicolon (<literal>;</literal>). このコマンドは、終了を意味するセミコロン(;)の置き換えで、SQL問い合わせを終えるために使われます。

When the <literal>\gset</literal> command is used, the preceding SQL query is expected to return one row, the columns of which are stored into variables named after column names, and prefixed with <replaceable>prefix</replaceable> if provided. \gsetコマンドが使われると、それまでのSQL問い合わせは1行を返すものと期待され、その行の列は列名にちなんだ名前の変数に格納されます。prefixが指定されていれば、変数名の前に付きます。

When the <literal>\aset</literal> command is used, all combined SQL queries (separated by <literal>\;</literal>) have their columns stored into variables named after column names, and prefixed with <replaceable>prefix</replaceable> if provided. If a query returns no row, no assignment is made and the variable can be tested for existence to detect this. If a query returns more than one row, the last value is kept. \asetコマンドが使われると、(\;で分けられた)すべての結合したSQL問い合わせは、その列が列名にちなんだ名前の変数に格納されます。prefixが指定されていれば、変数名の前に付きます。 問い合わせが行を返さなければ、割り当ては行なわれませんので、これを検出するために変数の存在をテストできます。 問い合わせが2行以上返した場合、最後の値が保持されます。

<literal>\gset</literal> and <literal>\aset</literal> cannot be used in pipeline mode, since the query results are not yet available by the time the commands would need them. \gset\asetはパイプラインモードでは使用できません。 これは、コマンドで必要になるまでに問い合わせの結果がまだ利用できないためです。

The following example puts the final account balance from the first query into variable <replaceable>abalance</replaceable>, and fills variables <replaceable>p_two</replaceable> and <replaceable>p_three</replaceable> with integers from the third query. The result of the second query is discarded. The result of the two last combined queries are stored in variables <replaceable>four</replaceable> and <replaceable>five</replaceable>. 以下の例は、最初の問い合わせからの最終的な口座残高を変数abalanceに入れ、変数p_twop_threeを3番目の問い合わせからの整数で埋めます。 2番目の問い合わせの結果は捨てられます。 最後の2つの結合した問い合わせの結果は、変数fourfiveに格納されます。

UPDATE pgbench_accounts
  SET abalance = abalance + :delta
  WHERE aid = :aid
  RETURNING abalance \gset

&#45;- compound of two queries

-- 2つの問い合わせの組み合わせ
SELECT 1 \;
SELECT 2 AS two, 3 AS three \gset p_
SELECT 4 AS four \; SELECT 5 AS five \aset
\if expression
\elif expression
\else
\endif #

This group of commands implements nestable conditional blocks, similarly to <literal>psql</literal>'s <xref linkend="psql-metacommand-if"/>. Conditional expressions are identical to those with <literal>\set</literal>, with non-zero values interpreted as true. このコマンド群はpsql\if expressionと似た、入れ子にできる条件ブロックを実現します。 条件式は\setと同じで、非ゼロ値は真と解釈されます。

\set varname expression #

Sets variable <replaceable>varname</replaceable> to a value calculated from <replaceable>expression</replaceable>. The expression may contain the <literal>NULL</literal> constant, Boolean constants <literal>TRUE</literal> and <literal>FALSE</literal>, integer constants such as <literal>5432</literal>, double constants such as <literal>3.14159</literal>, references to variables <literal>:</literal><replaceable>variablename</replaceable>, <link linkend="pgbench-builtin-operators">operators</link> with their usual SQL precedence and associativity, <link linkend="pgbench-builtin-functions">function calls</link>, SQL <link linkend="functions-case"><token>CASE</token> generic conditional expressions</link> and parentheses. varname変数をexpressionから計算された値に設定します。 式(expression)には、NULL定数、真理値定数のTRUEFALSE5432のような整数の定数、3.14159のような倍精度実数の定数、変数を参照する :variablename、通常のSQLの優先度と結合規則での演算子関数呼び出し、SQLのCASE一般条件式および括弧を含むことができます。

Functions and most operators return <literal>NULL</literal> on <literal>NULL</literal> input. 関数と大部分の演算子はNULL入力にNULLを返します。

For conditional purposes, non zero numerical values are <literal>TRUE</literal>, zero numerical values and <literal>NULL</literal> are <literal>FALSE</literal>. 条件の用途では非ゼロの数値はTRUE、ゼロ数値とNULLFALSEです。

Too large or small integer and double constants, as well as integer arithmetic operators (<literal>+</literal>, <literal>-</literal>, <literal>*</literal> and <literal>/</literal>) raise errors on overflows. 大きすぎるもしくは小さすぎる整数や倍精度実数の定数は、整数算術演算子(+-*/)と同様にオーバーフローエラーになります。

When no final <token>ELSE</token> clause is provided to a <token>CASE</token>, the default value is <literal>NULL</literal>. CASEに最後のELSE句が与えられないとき、デフォルト値はNULLです。

Examples:

\set ntellers 10 * :scale
\set aid (1021 * random(1, 100000 * :scale)) % \
           (100000 * :scale) + 1
\set divx CASE WHEN :x <> 0 THEN :y/:x ELSE NULL END
\sleep number [ us | ms | s ] #

Causes script execution to sleep for the specified duration in microseconds (<literal>us</literal>), milliseconds (<literal>ms</literal>) or seconds (<literal>s</literal>). If the unit is omitted then seconds are the default. <replaceable>number</replaceable> can be either an integer constant or a <literal>:</literal><replaceable>variablename</replaceable> reference to a variable having an integer value. スクリプトの実行をマイクロ秒(us)、ミリ秒(ms)、秒(s)単位で指定した間待機させます。 単位を省略した場合、デフォルトは秒です。 numberは整数定数か整数値を持つ変数への:variablename参照のいずれかです。

Example:

\sleep 10 ms
\setshell varname command [ argument ... ] #

Sets variable <replaceable>varname</replaceable> to the result of the shell command <replaceable>command</replaceable> with the given <replaceable>argument</replaceable>(s). The command must return an integer value through its standard output. commandシェルコマンドを指定のargumentで実行した結果をvarname変数に設定します。 このコマンドは標準出力を通して整数値を返さなければなりません。

<replaceable>command</replaceable> and each <replaceable>argument</replaceable> can be either a text constant or a <literal>:</literal><replaceable>variablename</replaceable> reference to a variable. If you want to use an <replaceable>argument</replaceable> starting with a colon, write an additional colon at the beginning of <replaceable>argument</replaceable>. commandおよび各argumentは、テキスト定数または変数を参照する:variablenameとすることができます。 コロンから始まるargumentを使用したい場合、argumentの先頭にさらにコロンを付けなければなりません。

Example: 例:

\setshell variable_to_be_assigned command literal_argument :variable ::literal_starting_with_colon
\shell command [ argument ... ] #

Same as <literal>\setshell</literal>, but the result of the command is discarded. \setshellと同じですが、コマンドの結果は廃棄されます。

Example: 例:

\shell command literal_argument :variable ::literal_starting_with_colon
\startpipeline
\endpipeline #

These commands delimit the start and end of a pipeline of SQL statements. In pipeline mode, statements are sent to the server without waiting for the results of previous statements. See <xref linkend="libpq-pipeline-mode"/> for more details. Pipeline mode requires the use of extended query protocol. これらのコマンドは、SQL文のパイプラインの開始と終了を区切ります。 パイプラインモードでは、文は前の文の結果を待つことなくサーバに送信されます。 詳細は34.5を参照してください。 パイプラインモードでは、拡張問い合わせプロトコルを使用する必要があります。

組み込み演算子

<title>Built-in Operators</title>

The arithmetic, bitwise, comparison and logical operators listed in <xref linkend="pgbench-operators"/> are built into <application>pgbench</application> and may be used in expressions appearing in <link linkend="pgbench-metacommand-set"><literal>\set</literal></link>. The operators are listed in increasing precedence order. Except as noted, operators taking two numeric inputs will produce a double value if either input is double, otherwise they produce an integer result. 表 294に載っている算術、ビットごと、比較、論理の演算子はpgbenchに組み込まれていて、\setの式で使用できます。 演算子は優先度の低い順に載っています。 注意書きがある場合を除いて、2つの数値を取る演算子は、入力の片方が倍精度実数であれば倍精度実数の値を結果とし、そうでなければ整数の結果になります。

表294 pgbenchの演算子

<title>pgbench Operators</title>

Operator 演算子

Description 説明

Example(s)

boolean OR booleanboolean

Logical OR 論理OR

5 or 0TRUE

boolean AND booleanboolean

Logical AND 論理AND

3 and 0FALSE

NOT booleanboolean

Logical NOT 論理NOT

not falseTRUE

boolean IS [NOT] (NULL|TRUE|FALSE)boolean

Boolean value tests ブール値のテスト

1 is nullFALSE

value ISNULL|NOTNULLboolean

Nullness tests NULLであるかのテスト

1 notnullTRUE

number = numberboolean

Equal 等価

5 = 4FALSE

number <> numberboolean

Not equal 不等

5 <> 4TRUE

number != numberboolean

Not equal 不等

5 != 5FALSE

number < numberboolean

Less than より小さい

5 < 4FALSE

number <= numberboolean

Less than or equal to 以下

5 <= 4FALSE

number > numberboolean

Greater than より大きい

5 > 4TRUE

number >= numberboolean

Greater than or equal to 以上

5 >= 4TRUE

integer | integerinteger

Bitwise OR ビット毎のOR

1 | 23

integer # integerinteger

Bitwise XOR ビット毎のXOR

1 # 32

integer & integerinteger

Bitwise AND ビット毎のAND

1 & 31

~ integerinteger

Bitwise NOT ビット毎のNOT

~ 1-2

integer << integerinteger

Bitwise shift left ビット毎の左シフト

1 << 24

integer >> integerinteger

Bitwise shift right ビット毎の右シフト

8 >> 22

number + numbernumber

Addition 加算

5 + 49

number - numbernumber

Subtraction 減算

3 - 2.01.0

number * numbernumber

Multiplication 乗算

5 * 420

number / numbernumber

Division (truncates the result towards zero if both inputs are integers) 除算(入力が両方とも整数であれば、結果は0に向けて丸められる)

5 / 31

integer % integerinteger

Modulo (remainder) 剰余(余り)

3 % 21

- numbernumber

Negation 符号反転

- 2.0-2.0


組み込み関数

<title>Built-In Functions</title>

The functions listed in <xref linkend="pgbench-functions"/> are built into <application>pgbench</application> and may be used in expressions appearing in <link linkend="pgbench-metacommand-set"><literal>\set</literal></link>. 表 295に示す関数はpgbenchに組み込まれており、\setに現れる式の中で使うことができます。

list pgbench functions in alphabetical order

表295 pgbenchの関数

<title>pgbench Functions</title>

Function 関数

Description 説明

Example(s)

abs ( number ) <returnvalue></returnvalue> same type as input 入力と同じ型

Absolute value 絶対値

abs(-17)17

debug ( number ) <returnvalue></returnvalue> same type as input 入力と同じ型

Prints the argument to <systemitem>stderr</systemitem>, and returns the argument. 引数をstderrに出力し、引数を返す。

debug(5432.1)5432.1

double ( number ) → double

Casts to double. 倍精度実数にキャストする。

double(5432)5432.0

exp ( number ) → double

Exponential (<literal>e</literal> raised to the given power) 指数(eの指定した冪)

exp(1.0)2.718281828459045

greatest ( number [, ... ] ) → double if any argument is double, else integer

Selects the largest value among the arguments. 引数の中で最大の値を選択する。

greatest(5, 4, 3, 2)5

hash ( value [, seed ] ) → integer

This is an alias for <function>hash_murmur2</function>. これはhash_murmur2の別名です。

hash(10, 5432)-5817877081768721676

hash_fnv1a ( value [, seed ] ) → integer

Computes <ulink url="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function">FNV-1a hash</ulink>. FNV-1aハッシュを計算する。

hash_fnv1a(10, 5432)-7793829335365542153

hash_murmur2 ( value [, seed ] ) → integer

Computes <ulink url="https://en.wikipedia.org/wiki/MurmurHash">MurmurHash2 hash</ulink>. MurmurHash2ハッシュを計算する。

hash_murmur2(10, 5432)-5817877081768721676

int ( number ) → integer

Casts to integer. 整数にキャストする。

int(5.4 + 3.8)9

least ( number [, ... ] ) → double if any argument is double, else integer

Selects the smallest value among the arguments. 引数の中で最小の値を選択する。

least(5, 4, 3, 2.1)2.1

ln ( number ) → double

Natural logarithm 自然対数

ln(2.718281828459045)1.0

mod ( integer, integer ) → integer

Modulo (remainder) 剰余(余り)

mod(54, 32)22

permute ( i, size [, seed ] ) → integer

Permuted value of <parameter>i</parameter>, in the range <literal>[0, size)</literal>. This is the new position of <parameter>i</parameter> (modulo <parameter>size</parameter>) in a pseudorandom permutation of the integers <literal>0...size-1</literal>, parameterized by <parameter>seed</parameter>, see below. [0, size)の範囲のiの順列値。 これは、seedによってパラメーター化された整数0...size-1の疑似ランダム置換におけるi(modulo size)の新しい位置です。 以下を参照してください。

permute(0, 4) <returnvalue>an integer between 0 and 3</returnvalue> 0と3の間の整数

pi () → double

Approximate value of <phrase role="symbol_font">&pi;</phrase> πの近似値

pi()3.14159265358979323846

pow ( x, y ) → double

power ( x, y ) → double

<parameter>x</parameter> raised to the power of <parameter>y</parameter> xy

pow(2.0, 10)1024.0

random ( lb, ub ) → integer

Computes a uniformly-distributed random integer in <literal>[lb, ub]</literal>. [lb, ub]内の一様分布の整数の乱数を計算する。

random(1, 10) <returnvalue>an integer between 1 and 10</returnvalue> 1と10の間の整数

random_exponential ( lb, ub, parameter ) → integer

Computes an exponentially-distributed random integer in <literal>[lb, ub]</literal>, see below. [lb, ub]内の指数分布の整数の乱数を計算する、後述。

random_exponential(1, 10, 3.0) <returnvalue>an integer between 1 and 10</returnvalue> 1と10の間の整数

random_gaussian ( lb, ub, parameter ) → integer

Computes a Gaussian-distributed random integer in <literal>[lb, ub]</literal>, see below. [lb, ub]内のガウス分布の整数の乱数を計算する、後述。

random_gaussian(1, 10, 2.5) <returnvalue>an integer between 1 and 10</returnvalue> 1と10の間の整数

random_zipfian ( lb, ub, parameter ) → integer

Computes a Zipfian-distributed random integer in <literal>[lb, ub]</literal>, see below. [lb, ub]内のジップ分布の整数の乱数を計算する、後述。

random_zipfian(1, 10, 1.5) <returnvalue>an integer between 1 and 10</returnvalue> 1と10の間の整数

sqrt ( number ) → double

Square root 平方根

sqrt(2.0)1.414213562


The <literal>random</literal> function generates values using a uniform distribution, that is all the values are drawn within the specified range with equal probability. The <literal>random_exponential</literal>, <literal>random_gaussian</literal> and <literal>random_zipfian</literal> functions require an additional double parameter which determines the precise shape of the distribution. random関数は一様分布を使って値を生成します。 つまり、すべての値は指定された範囲内で同じ確率で発生します。 random_exponentialrandom_gaussian、および、random_zipfian関数は追加の倍精度実数のパラメータを必要とし、それによって分布の正確な形が決まります。

  • For an exponential distribution, <replaceable>parameter</replaceable> controls the distribution by truncating a quickly-decreasing exponential distribution at <replaceable>parameter</replaceable>, and then projecting onto integers between the bounds. To be precise, with 指数分布では、parameterが分布を制御します。 急速に減少する指数分布をparameterで切り捨て、境界範囲内の整数に射影します。 正確には、以下の式に従います。


    f(x) = exp(-parameter * (x - min) / (max - min + 1)) / (1 - exp(-parameter))

    Then value <replaceable>i</replaceable> between <replaceable>min</replaceable> and <replaceable>max</replaceable> inclusive is drawn with probability: <literal>f(i) - f(i + 1)</literal>. これにより、minmaxの間(両端を含む)の間の値if(i) - f(i + 1)の確率で生成されます。

    Intuitively, the larger the <replaceable>parameter</replaceable>, the more frequently values close to <replaceable>min</replaceable> are accessed, and the less frequently values close to <replaceable>max</replaceable> are accessed. The closer to 0 <replaceable>parameter</replaceable> is, the flatter (more uniform) the access distribution. A crude approximation of the distribution is that the most frequent 1% values in the range, close to <replaceable>min</replaceable>, are drawn <replaceable>parameter</replaceable>% of the time. The <replaceable>parameter</replaceable> value must be strictly positive. 直感的には、parameterが大きければ、minに近い値が発生する確率が高くなり、maxに近い値が発生する確率が低くなります。 parameterが0に近ければ、発生の分布はより平ら(より一様)になります。 大雑把に分布を近似すると、minに近い最頻の1%の範囲の値は、parameter%の割合で発生します。 parameterの値は厳密に正でなければなりません。

  • For a Gaussian distribution, the interval is mapped onto a standard normal distribution (the classical bell-shaped Gaussian curve) truncated at <literal>-parameter</literal> on the left and <literal>+parameter</literal> on the right. Values in the middle of the interval are more likely to be drawn. To be precise, if <literal>PHI(x)</literal> is the cumulative distribution function of the standard normal distribution, with mean <literal>mu</literal> defined as <literal>(max + min) / 2.0</literal>, with ガウス分布では、標準的な正規分布(古典的なベルの形をしたガウス曲線)で、左に-parameter、右に+parameterのところで切り捨てられたものに間隔が射影されます。 間隔の中間の値が発生する確率が最も高くなります。 正確に言うと、PHI(x)は標準正規分布の累積分布関数、平均値mu(max + min) / 2.0と定義し、さらに


    f(x) = PHI(2.0 * parameter * (x - mu) / (max - min + 1)) /
           (2.0 * PHI(parameter) - 1)

    then value <replaceable>i</replaceable> between <replaceable>min</replaceable> and <replaceable>max</replaceable> inclusive is drawn with probability: <literal>f(i + 0.5) - f(i - 0.5)</literal>. Intuitively, the larger the <replaceable>parameter</replaceable>, the more frequently values close to the middle of the interval are drawn, and the less frequently values close to the <replaceable>min</replaceable> and <replaceable>max</replaceable> bounds. About 67% of values are drawn from the middle <literal>1.0 / parameter</literal>, that is a relative <literal>0.5 / parameter</literal> around the mean, and 95% in the middle <literal>2.0 / parameter</literal>, that is a relative <literal>1.0 / parameter</literal> around the mean; for instance, if <replaceable>parameter</replaceable> is 4.0, 67% of values are drawn from the middle quarter (1.0 / 4.0) of the interval (i.e., from <literal>3.0 / 8.0</literal> to <literal>5.0 / 8.0</literal>) and 95% from the middle half (<literal>2.0 / 4.0</literal>) of the interval (second and third quartiles). The minimum allowed <replaceable>parameter</replaceable> value is 2.0. とすると、minmaxの間(両端を含む)の値iが発生する確率はf(i + 0.5) - f(i - 0.5)になります。 直感的には、parameterが大きくなれば、間隔の中間に近い値になる確率が高く、また、minmaxの境界に近い値になる確率は低くなります。 約67%の値は、中間の1.0 / parameterの範囲、つまり平均値から0.5 / parameterの範囲から、また95%は中間の2.0 / parameterの範囲、つまり平均値から1.0 / parameterの範囲に発生します。 例えばparameterが4.0なら、67%の値は間隔の中間の4分の1(1.0/4.0)から(つまり3.0 / 8.0から5.0 / 8.0まで)、95%は間隔の中間の半分(2.0 / 4.0)から(2番目と3番目の四分位)から発生します。 許される最小のparameter値は2.0です。

  • <literal>random_zipfian</literal> generates a bounded Zipfian distribution. <replaceable>parameter</replaceable> defines how skewed the distribution is. The larger the <replaceable>parameter</replaceable>, the more frequently values closer to the beginning of the interval are drawn. The distribution is such that, assuming the range starts from 1, the ratio of the probability of drawing <replaceable>k</replaceable> versus drawing <replaceable>k+1</replaceable> is <literal>((<replaceable>k</replaceable>+1)/<replaceable>k</replaceable>)**<replaceable>parameter</replaceable></literal>. For example, <literal>random_zipfian(1, ..., 2.5)</literal> produces the value <literal>1</literal> about <literal>(2/1)**2.5 = 5.66</literal> times more frequently than <literal>2</literal>, which itself is produced <literal>(3/2)**2.5 = 2.76</literal> times more frequently than <literal>3</literal>, and so on. random_zipfianは制限付きのジップ分布を生成します。 parameterはどれほど歪んだ分布かを定義します。 より大きいparameterほど、より高頻度に区間の始点に近い値が描かれます。 範囲が1から始まるとして、kを描く確率とk+1を描く確率の比が((k+1)/k)**parameterという分布になります。 例えば、random_zipfian(1, ..., 2.5)は、値12の約(2/1)**2.5 = 5.66倍高い頻度で生成し、値23の約(3/2)**2.5 = 2.76倍高い頻度で生成し、以下同様に続きます。

    <application>pgbench</application>'s implementation is based on "Non-Uniform Random Variate Generation", Luc Devroye, p. 550-551, Springer 1986. Due to limitations of that algorithm, the <replaceable>parameter</replaceable> value is restricted to the range [1.001, 1000]. pgbenchの実装は「Non-Uniform Random Variate Generation」Luc Devroye(Springer 1986, p. 550-551)に基づいており、parameter値は[1.001, 1000]の範囲に限定されています。

注記

When designing a benchmark which selects rows non-uniformly, be aware that the rows chosen may be correlated with other data such as IDs from a sequence or the physical row ordering, which may skew performance measurements. 行を不均一に選択するベンチマークを設計する場合、選択された行はシーケンスからのIDや物理的な行の順序など他のデータと相関している可能性があり、性能測定に影響を与える可能性があることに留意してください。

To avoid this, you may wish to use the <function>permute</function> function, or some other additional step with similar effect, to shuffle the selected rows and remove such correlations. これを避けるには、permute関数、または同様の効果を持つ他の追加手順を使用して、選択した行をシャッフルし、そのような相関関係を削除することをお勧めします。

Hash functions <literal>hash</literal>, <literal>hash_murmur2</literal> and <literal>hash_fnv1a</literal> accept an input value and an optional seed parameter. In case the seed isn't provided the value of <literal>:default_seed</literal> is used, which is initialized randomly unless set by the command-line <literal>-D</literal> option. ハッシュ関数hashhash_murmur2およびhash_fnv1aは入力値とオプションシードパラメータを受け付けます。 シードが与えられなかった場合、:default_seedの値が使われます。これは、コマンドライン-Dオプションで設定されない限りランダムに初期化されたものです。

<literal>permute</literal> accepts an input value, a size, and an optional seed parameter. It generates a pseudorandom permutation of integers in the range <literal>[0, size)</literal>, and returns the index of the input value in the permuted values. The permutation chosen is parameterized by the seed, which defaults to <literal>:default_seed</literal>, if not specified. Unlike the hash functions, <literal>permute</literal> ensures that there are no collisions or holes in the output values. Input values outside the interval are interpreted modulo the size. The function raises an error if the size is not positive. <function>permute</function> can be used to scatter the distribution of non-uniform random functions such as <literal>random_zipfian</literal> or <literal>random_exponential</literal> so that values drawn more often are not trivially correlated. For instance, the following <application>pgbench</application> script simulates a possible real world workload typical for social media and blogging platforms where a few accounts generate excessive load: permuteは、入力値とサイズとオプションシードパラメータを受け付けます。 [0, size)の範囲の整数の疑似ランダム置換を生成し、並べ換えられた値の入力値のインデックスを返します。 選択される並べ換えはシードによってパラメータ化され、指定されていない場合:default_seedがデフォルトになります。 ハッシュ関数とは異なり、permuteは出力値に衝突や穴がないことを保証します。 区間外の入力値は、サイズを法として解釈されます。サイズが正でない場合、関数はエラーを発生させます。 permuterandom_zipfianrandom_exponentialのような不均一なランダム関数の分布を分散させて、より頻繁に導出される値が自明に相関しないようにすることができます。 たとえば、以下のpgbenchスクリプトは、僅かなアカウントが過大な負荷を生成するソーシャルメディアやブログのプラットフォームで起こりえる現実世界のワークロードをシミュレートします。

\set size 1000000
\set r random_zipfian(1, :size, 1.07)
\set k 1 + permute(:r, :size)

In some cases several distinct distributions are needed which don't correlate with each other and this is when the optional seed parameter comes in handy: 一部のケースでは、互いに無関係ないくつかの異なる分布が必要で、これはオプションのシードパラメータが役立ちます。

\set k1 1 + permute(:r, :size, :default_seed + 123)
\set k2 1 + permute(:r, :size, :default_seed + 321)

A similar behavior can also be approximated with <function>hash</function>: 同様の動作は、hashでも近似的に行うことができます。

\set size 1000000
\set r random_zipfian(1, 100 * :size, 1.07)
\set k 1 + abs(hash(:r)) % :size

However, since <function>hash</function> generates collisions, some values will not be reachable and others will be more frequent than expected from the original distribution. しかし、hashは衝突を発生させるため、到達できない値もあれば、元の分布から予想されるよりも頻度が高い値もあります。

As an example, the full definition of the built-in TPC-B-like transaction is: 例えば、組み込みのTPC-Bのようなトランザクションの完全な定義を示します。

\set aid random(1, 100000 * :scale)
\set bid random(1, 1 * :scale)
\set tid random(1, 10 * :scale)
\set delta random(-5000, 5000)
BEGIN;
UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
END;

This script allows each iteration of the transaction to reference different, randomly-chosen rows. (This example also shows why it's important for each client session to have its own variables &mdash; otherwise they'd not be independently touching different rows.) このスクリプトにより、トランザクションを繰り返す度に異なる、ランダムに選ばれた行を参照することができます。 (この例はまた、各クライアントセッションがなぜ独自の変数を持つことが重要なのかも表しています。 これがないと、異なる行を独立して参照することができないのです。)

トランザクション毎のログ処理

<title>Per-Transaction Logging</title>

With the <option>-l</option> option (but without the <option>&#45;-aggregate-interval</option> option), <application>pgbench</application> writes information about each transaction to a log file. The log file will be named <filename><replaceable>prefix</replaceable>.<replaceable>nnn</replaceable></filename>, where <replaceable>prefix</replaceable> defaults to <literal>pgbench_log</literal>, and <replaceable>nnn</replaceable> is the PID of the <application>pgbench</application> process. The prefix can be changed by using the <option>&#45;-log-prefix</option> option. If the <option>-j</option> option is 2 or higher, so that there are multiple worker threads, each will have its own log file. The first worker will use the same name for its log file as in the standard single worker case. The additional log files for the other workers will be named <filename><replaceable>prefix</replaceable>.<replaceable>nnn</replaceable>.<replaceable>mmm</replaceable></filename>, where <replaceable>mmm</replaceable> is a sequential number for each worker starting with 1. --aggregate-intervalオプションなしで)-lオプションを使用すると、pgbenchは各トランザクションに関する情報をログファイルに書き出します。 ログファイルの名前はprefix.nnnで、prefixのデフォルトはpgbench_lognnnpgbenchプロセスのPIDです。 ファイル名の先頭の文字列は--log-prefixオプションを使って変更することができます。 -jオプションが2以上で複数のワーカースレッドがある場合、それぞれが独自のログファイルを持つことになります。 最初のワーカーは標準的な単一ワーカーの場合と同じ名前を持つログファイルを使用します。 他のワーカー用の追加のログファイルはprefix.nnn.mmmと命名され、ここでmmmは1から始まる各ワーカーの連番です。

Each line in a log file describes one transaction. It contains the following space-separated fields: ログファイルの各行には1つのトランザクションが記述されています。 このログファイルには、スペースで区切られた次のフィールドが含まれています:

client_id

identifies the client session that ran the transaction トランザクションを実行したクライアントセッションを示します

transaction_no

counts how many transactions have been run by that session そのセッションで実行されたトランザクションの数をカウントします

time

transaction's elapsed time, in microseconds トランザクションの経過時間(マイクロ秒)

script_no

identifies the script file that was used for the transaction (useful when multiple scripts are specified with <option>-f</option> or <option>-b</option>) トランザクションに使用されたスクリプトファイルを示します(複数のスクリプトが-fまたは-bで指定されている場合に便利です)

time_epoch

transaction's completion time, as a Unix-epoch time stamp トランザクションの完了時刻(Unixエポックタイムスタンプ)

time_us

fractional-second part of transaction's completion time, in microseconds トランザクションの完了時間の分数秒部分(マイクロ秒)

schedule_lag

transaction start delay, that is the difference between the transaction's scheduled start time and the time it actually started, in microseconds (present only if <option>&#45;-rate</option> is specified) トランザクション開始遅延、つまりトランザクションのスケジュールされた開始時刻と実際に開始された時刻の差をマイクロ秒単位で表したものです(--rateが指定されている場合にのみ存在します)

retries

count of retries after serialization or deadlock errors during the transaction (present only if <option>&#45;-max-tries</option> is not equal to one) 直列化エラーまたはトランザクション中のデッドロックエラー後の再試行のカウントします (--max-triesが1でない場合にのみ存在する)

When both <option>&#45;-rate</option> and <option>&#45;-latency-limit</option> are used, the <replaceable>time</replaceable> for a skipped transaction will be reported as <literal>skipped</literal>. If the transaction ends with a failure, its <replaceable>time</replaceable> will be reported as <literal>failed</literal>. If you use the <option>&#45;-failures-detailed</option> option, the <replaceable>time</replaceable> of the failed transaction will be reported as <literal>serialization</literal> or <literal>deadlock</literal> depending on the type of failure (see <xref linkend="failures-and-retries"/> for more information). --rate--latency-limitの両方を使用すると、スキップされたトランザクションのtimeskippedとして報告されます。 トランザクションが失敗で終了した場合、timefailedとして報告されます。 --failures-detailedオプションを使用すると、失敗したトランザクションのtimeは、障害のタイプに応じて直列化またはデットロックとして報告されます(詳細は直列化の失敗/デットロック再試行を参照してください)。

Here is a snippet of a log file generated in a single-client run: 単一クライアントでの実行で生成されたログファイルの一部を示します。

0 199 2241 0 1175850568 995598
0 200 2465 0 1175850568 998079
0 201 2513 0 1175850569 608
0 202 2038 0 1175850569 2663

Another example with <literal>&#45;-rate=100</literal> and <literal>&#45;-latency-limit=5</literal> (note the additional <replaceable>schedule_lag</replaceable> column): --rate=100--latency-limit=5を指定した例を示します。(schedule_lag列が追加されていることに注意)

0 81 4621 0 1412881037 912698 3005
0 82 6173 0 1412881037 914578 4304
0 83 skipped 0 1412881037 914578 5217
0 83 skipped 0 1412881037 914578 5099
0 83 4722 0 1412881037 916203 3108
0 84 4142 0 1412881037 918023 2333
0 85 2465 0 1412881037 919759 740

In this example, transaction 82 was late, because its latency (6.173 ms) was over the 5 ms limit. The next two transactions were skipped, because they were already late before they were even started. この例では、トランザクション82は遅延(6.173ミリ秒)が5ミリ秒を越えており、遅れています。 次の2つのトランザクションは、開始する前にすでに遅れてしまっているため、スキップされています。

The following example shows a snippet of a log file with failures and retries, with the maximum number of tries set to 10 (note the additional <replaceable>retries</replaceable> column): 次の例は、最大試行回数を10に設定した失敗と再試行のログファイルの一部を示しています(追加再試行列に注意)。

3 0 47423 0 1499414498 34501 3
3 1 8333 0 1499414498 42848 0
3 2 8358 0 1499414498 51219 0
4 0 72345 0 1499414498 59433 6
1 3 41718 0 1499414498 67879 4
1 4 8416 0 1499414498 76311 0
3 3 33235 0 1499414498 84469 3
0 0 failed 0 1499414498 84905 9
2 0 failed 0 1499414498 86248 9
3 4 8307 0 1499414498 92788 0

If the <option>&#45;-failures-detailed</option> option is used, the type of failure is reported in the <replaceable>time</replaceable> like this: --failures-detailedオプションを使用すると、障害のタイプは次のように時間で報告されます。

3 0 47423 0 1499414498 34501 3
3 1 8333 0 1499414498 42848 0
3 2 8358 0 1499414498 51219 0
4 0 72345 0 1499414498 59433 6
1 3 41718 0 1499414498 67879 4
1 4 8416 0 1499414498 76311 0
3 3 33235 0 1499414498 84469 3
0 0 serialization 0 1499414498 84905 9
2 0 serialization 0 1499414498 86248 9
3 4 8307 0 1499414498 92788 0

When running a long test on hardware that can handle a lot of transactions, the log files can become very large. The <option>&#45;-sampling-rate</option> option can be used to log only a random sample of transactions. 大量のトランザクションを処理することができるハードウェアで長時間試験を実行する場合、ログファイルは非常に大きくなる可能性があります。 --sampling-rateオプションを使用して、トランザクションのランダムなサンプルだけをログに記録することができます。

ログ処理の集約

<title>Aggregated Logging</title>

With the <option>&#45;-aggregate-interval</option> option, a different format is used for the log files. Each log line describes one aggregation interval. It contains the following space-separated fields: --aggregate-intervalオプションを使用すると、ログファイルに異なるフォーマットが使用されます。 各ログ行は1つの集約間隔を記述します。 このログ行には、スペースで区切られた次のフィールドが含まれます:

interval_start

start time of the interval, as a Unix-epoch time stamp 間隔の開始時刻(Unixエポックタイムスタンプ)

num_transactions

number of transactions within the interval 間隔内のトランザクション数

sum_latency

sum of transaction latencies トランザクション待ち時間の合計

sum_latency_2

sum of squares of transaction latencies トランザクション待ち時間の平方和

min_latency

minimum transaction latency 最小トランザクション待ち時間

max_latency

maximum transaction latency 最大トランザクション待ち時間

sum_lag

sum of transaction start delays (zero unless <option>&#45;-rate</option> is specified) トランザクション開始遅延の合計(--rateが指定されていない場合は0)

sum_lag_2

sum of squares of transaction start delays (zero unless <option>&#45;-rate</option> is specified) トランザクション開始遅延の平方和(--rateが指定されていない場合は0)

min_lag

minimum transaction start delay (zero unless <option>&#45;-rate</option> is specified) 最小トランザクション開始遅延(--rateが指定されていない場合は0)

max_lag

maximum transaction start delay (zero unless <option>&#45;-rate</option> is specified) 最大トランザクション開始遅延(--rateが指定されていない場合は0)

skipped

number of transactions skipped because they would have started too late (zero unless <option>&#45;-rate</option> and <option>&#45;-latency-limit</option> are specified) 開始が遅すぎたためにスキップされたトランザクションの数(--rate--latency-limitが指定されていない場合は0)

retried

number of retried transactions (zero unless <option>&#45;-max-tries</option> is not equal to one) 再試行されたトランザクションの数(--max-triesが1でない場合は0)

retries

number of retries after serialization or deadlock errors (zero unless <option>&#45;-max-tries</option> is not equal to one) 直列化エラーまたはデッドロックエラー後の再試行回数 (--max-triesが1でない場合は0)

serialization_failures

number of transactions that got a serialization error and were not retried afterwards (zero unless <option>&#45;-failures-detailed</option> is specified) 直列化エラーが発生し、その後再試行されなかったトランザクションの数(--failures-detailedが指定されていない場合は0)

deadlock_failures

number of transactions that got a deadlock error and were not retried afterwards (zero unless <option>&#45;-failures-detailed</option> is specified) デッドロックエラーが発生し、その後再試行されなかったトランザクションの数(--failures-detailedが指定されていない場合は0)

Here is some example output generated with these options: 以下に、これらのオプションで生成された出力例を示します。

pgbench --aggregate-interval=10 --time=20 --client=10 --log --rate=1000 --latency-limit=10 --failures-detailed --max-tries=10 test

1650260552 5178 26171317 177284491527 1136 44462 2647617 7321113867 0 9866 64 7564 28340 4148 0
1650260562 4808 25573984 220121792172 1171 62083 3037380 9666800914 0 9998 598 7392 26621 4527 0

Notice that while the plain (unaggregated) log format shows which script was used for each transaction, the aggregated format does not. Therefore if you need per-script data, you need to aggregate the data on your own. 通常の(集約されていない)ログフォーマットは、各トランザクションについてどのスクリプトファイルが使用されたかを示しますが、集約されたログにはそれがないことに注意してください。 このためスクリプト単位のデータが必要な場合は、自身でデータを集約する必要があります。

文ごとの報告

<title>Per-Statement Report</title>

With the <option>-r</option> option, <application>pgbench</application> collects the following statistics for each statement: -rオプションを使用すると、pgbenchは文ごとに次の統計情報を収集します。

  • <literal>latency</literal> &mdash; elapsed transaction time for each statement. <application>pgbench</application> reports an average value of all successful runs of the statement. latency—各文の経過トランザクション時間。 pgbenchは文のすべての成功した実行の平均値を報告します。

  • The number of failures in this statement. See <xref linkend="failures-and-retries"/> for more information. この文の失敗数。 詳細は直列化の失敗/デットロック再試行を参照してください。

  • The number of retries after a serialization or a deadlock error in this statement. See <xref linkend="failures-and-retries"/> for more information. この文の直列化エラーまたはデッドロックエラー後の再試行回数。 詳細は直列化の失敗/デットロック再試行を参照してください。

The report displays retry statistics only if the <option>&#45;-max-tries</option> option is not equal to 1. レポートに再試行統計情報が表示されるのは、--max-triesオプションが1に等しくない場合だけです。

All values are computed for each statement executed by every client and are reported after the benchmark has finished. すべての値は、各クライアントによって実行される文ごとに計算され、ベンチマークが終了した後に報告されます。

For the default script, the output will look similar to this: 標準スクリプトでは、次のような出力になります。

starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 10
number of threads: 1
maximum number of tries: 1
number of transactions per client: 1000
number of transactions actually processed: 10000/10000
number of failed transactions: 0 (0.000%)
number of transactions above the 50.0 ms latency limit: 1311/10000 (13.110 %)
latency average = 28.488 ms
latency stddev = 21.009 ms
initial connection time = 69.068 ms
tps = 346.224794 (without initial connection time)
statement latencies in milliseconds and failures:
   0.012  0  \set aid random(1, 100000 * :scale)
   0.002  0  \set bid random(1, 1 * :scale)
   0.002  0  \set tid random(1, 10 * :scale)
   0.002  0  \set delta random(-5000, 5000)
   0.319  0  BEGIN;
   0.834  0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
   0.641  0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
  11.126  0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
  12.961  0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
   0.634  0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
   1.957  0  END;

Another example of output for the default script using serializable default transaction isolation level (<command>PGOPTIONS='-c default_transaction_isolation=serializable' pgbench ...</command>): デフォルトトランザクション分離レベルにシリアライザブルを使用したデフォルトスクリプトの別の出力例(PGOPTIONS='-c default_transaction_isolation=serializable'pgbench.):

starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 10
number of threads: 1
maximum number of tries: 10
number of transactions per client: 1000
number of transactions actually processed: 6317/10000
number of failed transactions: 3683 (36.830%)
number of transactions retried: 7667 (76.670%)
total number of retries: 45339
number of transactions above the 50.0 ms latency limit: 106/6317 (1.678 %)
latency average = 17.016 ms
latency stddev = 13.283 ms
initial connection time = 45.017 ms
tps = 186.792667 (without initial connection time)
statement latencies in milliseconds, failures and retries:
  0.006     0      0  \set aid random(1, 100000 * :scale)
  0.001     0      0  \set bid random(1, 1 * :scale)
  0.001     0      0  \set tid random(1, 10 * :scale)
  0.001     0      0  \set delta random(-5000, 5000)
  0.385     0      0  BEGIN;
  0.773     0      1  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
  0.624     0      0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
  1.098   320   3762  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
  0.582  3363  41576  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
  0.465     0      0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
  1.933     0      0  END;

If multiple script files are specified, all statistics are reported separately for each script file. 複数のスクリプトファイルが定義された場合、すべての統計処理はそれぞれのスクリプトファイル毎に分けて報告されます。

Note that collecting the additional timing information needed for per-statement latency computation adds some overhead. This will slow average execution speed and lower the computed TPS. The amount of slowdown varies significantly depending on platform and hardware. Comparing average TPS values with and without latency reporting enabled is a good way to measure if the timing overhead is significant. 文ごとのレイテンシを計算するために必要となる、追加のタイミング情報を収集することは、オーバーヘッドが加わることに注意してください。 これは平均実行速度を遅くし、計測TPSを小さくするでしょう。 低下量はプラットフォームとハードウェアに依存して著しく変わります。 レイテンシの報告を有効にする、有効にしないで平均TPS値を比較することは、タイミング・オーバーヘッドが顕著かどうかを測定するには良い方法です。

<refsect2 id="failures-and-retries" xreflabel="Failures and Serialization/Deadlock Retries"> <title>Failures and Serialization/Deadlock Retries</title>

直列化の失敗/デットロック再試行

When executing <application>pgbench</application>, there are three main types of errors: pgbenchの実行時に発生する主なエラーには以下の3種類があります。

  • Errors of the main program. They are the most serious and always result in an immediate exit from <application>pgbench</application> with the corresponding error message. They include: メインプログラムのエラーです。 これらは最も深刻で、常にpgbenchを即座に終了し、対応するエラーメッセージが表示されます。 これらのエラーには以下のようなものがあります:

    • errors at the beginning of <application>pgbench</application> (e.g. an invalid option value); pgbenchの先頭のエラー(例えば無効なオプション値)。

    • errors in the initialization mode (e.g. the query to create tables for built-in scripts fails); 初期化モードでエラーが発生する(例えば、組み込みスクリプト用のテーブルを作成するクエリが失敗する)。

    • errors before starting threads (e.g. could not connect to the database server, syntax error in the meta command, thread creation failure); スレッドを開始する前のエラー(データベースサーバに接続できない、メタコマンドの構文エラー、スレッド作成の失敗など)。

    • internal <application>pgbench</application> errors (which are supposed to never occur...). 内部pgbenchエラーです(決して発生しないはずです…)。

  • Errors when the thread manages its clients (e.g. the client could not start a connection to the database server / the socket for connecting the client to the database server has become invalid). In such cases all clients of this thread stop while other threads continue to work. スレッドがクライアントを管理するときのエラー(クライアントがデータベースサーバへの接続を開始できなかった/クライアントをデータベースサーバに接続するためのソケットが無効になったなど)。 このような場合、このスレッドのすべてのクライアントは停止し、他のスレッドは作業を継続します。

  • Direct client errors. They lead to immediate exit from <application>pgbench</application> with the corresponding error message only in the case of an internal <application>pgbench</application> error (which are supposed to never occur...). Otherwise in the worst case they only lead to the abortion of the failed client while other clients continue their run (but some client errors are handled without an abortion of the client and reported separately, see below). Later in this section it is assumed that the discussed errors are only the direct client errors and they are not internal <application>pgbench</application> errors. 直接的なクライアントエラーです。 内部pgbenchエラーの場合にのみpgbenchを即座に終了し、対応するエラーメッセージが表示されます(これは決して発生しないはずです…)。 そうでなければ、最悪の場合には、他のクライアントが実行を継続している間に、失敗したクライアントが中断されるだけです(ただし、クライアントエラーの中には、クライアントの中断なしに処理され、別途報告されるものもあります。以下を参照してください)。 この節の後半では、説明されているエラーは直接的なクライアントエラーだけであり、内部pgbenchエラーではないと仮定します。

A client's run is aborted in case of a serious error; for example, the connection with the database server was lost or the end of script was reached without completing the last transaction. In addition, if execution of an SQL or meta command fails for reasons other than serialization or deadlock errors, the client is aborted. Otherwise, if an SQL command fails with serialization or deadlock errors, the client is not aborted. In such cases, the current transaction is rolled back, which also includes setting the client variables as they were before the run of this transaction (it is assumed that one transaction script contains only one transaction; see <xref linkend="transactions-and-scripts"/> for more information). Transactions with serialization or deadlock errors are repeated after rollbacks until they complete successfully or reach the maximum number of tries (specified by the <option>&#45;-max-tries</option> option) / the maximum time of retries (specified by the <option>&#45;-latency-limit</option> option) / the end of benchmark (specified by the <option>&#45;-time</option> option). If the last trial run fails, this transaction will be reported as failed but the client is not aborted and continues to work. 重大なエラーが発生した場合、クライアントの実行は中断されます。 たとえば、データベースサーバーとの接続が失われた場合や、最後のトランザクションを完了せずにスクリプトの終了に達した場合などです。 また、SQLまたはメタコマンドの実行が直列化エラーまたはデッドロックエラー以外の理由で失敗した場合、クライアントは中断されます。 そうでない場合、SQLコマンドが直列化エラーまたはデッドロックエラーで失敗した場合、クライアントは中断されません。 このような場合、現在のトランザクションがロールバックされます。 これには、クライアント変数がこのトランザクションの実行前の状態に設定されます(1つのトランザクションスクリプトには1つのトランザクションのみが含まれていると仮定されます。詳細はpgbenchで実際に実行される"トランザクション"は何か?を参照してください)。 直列化エラーまたはデッドロックエラーのあるトランザクションは、正常に完了するか、最大試行回数(--max-triesオプションで指定/最大再試行時間(--latency-limitオプションで指定)/ベンチマークの終了(--timeオプションで指定)に達するまで、ロールバック後に繰り返されます。 最後の試運転が失敗した場合、このトランザクションは失敗として報告されますが、クライアントは中断されずに処理を続行します。

注記

Without specifying the <option>&#45;-max-tries</option> option, a transaction will never be retried after a serialization or deadlock error because its default value is 1. Use an unlimited number of tries (<literal>&#45;-max-tries=0</literal>) and the <option>&#45;-latency-limit</option> option to limit only the maximum time of tries. You can also use the <option>&#45;-time</option> option to limit the benchmark duration under an unlimited number of tries. --max-triesオプションを指定しない場合、デフォルト値が1であるため、シリアライゼーションエラーまたはデッドロックエラーの後にトランザクションが再試行されることはありません。 試行回数を無制限にし(--max-tries=0)、--latency-limitオプションを使用して、試行の最大時間のみを制限します。 また、--timeオプションを使用して、試行回数を無制限にしてベンチマーク期間を制限することもできます。

Be careful when repeating scripts that contain multiple transactions: the script is always retried completely, so successful transactions can be performed several times. 複数のトランザクションを含むスクリプトを繰り返す場合は注意が必要です。 スクリプトは常に完全に再試行されるため、成功したトランザクションが複数回実行される可能性があります。

Be careful when repeating transactions with shell commands. Unlike the results of SQL commands, the results of shell commands are not rolled back, except for the variable value of the <command>\setshell</command> command. シェルコマンドでトランザクションを繰り返す場合は注意してください。 SQLコマンドの結果とは異なり、\setshellコマンドの変数値を除いて、シェルコマンドの結果はロールバックされません。

The latency of a successful transaction includes the entire time of transaction execution with rollbacks and retries. The latency is measured only for successful transactions and commands but not for failed transactions or commands. 成功したトランザクションの待機時間には、ロールバックおよび再試行によるトランザクションの実行時間全体が含まれます。 待機時間は、成功したトランザクションおよびコマンドについてのみ測定され、失敗したトランザクションまたはコマンドについては測定されません。

The main report contains the number of failed transactions. If the <option>&#45;-max-tries</option> option is not equal to 1, the main report also contains statistics related to retries: the total number of retried transactions and total number of retries. The per-script report inherits all these fields from the main report. The per-statement report displays retry statistics only if the <option>&#45;-max-tries</option> option is not equal to 1. メインレポートには、失敗したトランザクションの数が含まれます。 --max-triesオプションが1以外の場合、メインレポートには再試行に関する統計(再試行されたトランザクションの合計数と再試行の合計数)も含まれます。 スクリプト単位のレポートは、メインレポートからこれらのフィールドをすべて継承します。 文単位のレポートには、--max-triesオプションが1以外の場合にのみ再試行の統計が表示されます。

If you want to group failures by basic types in per-transaction and aggregation logs, as well as in the main and per-script reports, use the <option>&#45;-failures-detailed</option> option. If you also want to distinguish all errors and failures (errors without retrying) by type including which limit for retries was exceeded and how much it was exceeded by for the serialization/deadlock failures, use the <option>&#45;-verbose-errors</option> option. トランザクションごとおよび集約ログ、メインレポートおよびスクリプトごとのレポートで障害を基本タイプ別にグループ化する場合は、--failures-detailedオプションを使用します。 また、すべてのエラーおよび障害(再試行しない場合のエラー)をタイプ別に区別する場合は、--verbose-errorsオプションを使用します。 これには、直列化エラー/デッドロック障害でどの再試行制限を超えたか、どの程度超えたかなどが含まれます。

テーブルアクセスメソッド

<title>Table Access Methods</title>

You may specify the <link linkend="tableam">Table Access Method</link> for the pgbench tables. The environment variable <envar>PGOPTIONS</envar> specifies database configuration options that are passed to PostgreSQL via the command line (See <xref linkend="config-setting-shell"/>). For example, a hypothetical default Table Access Method for the tables that pgbench creates called <literal>wuzza</literal> can be specified with: pgbenchテーブルにはテーブルアクセスメソッドを指定できます。 環境変数PGOPTIONSは、コマンドライン経由でPostgreSQLに渡されるデータベース設定オプションを指定します(20.1.4を参照してください)。 例えば、pgbenchが作成するテーブル用のwuzzaと呼ばれる架空のデフォルトテーブルアクセスメソッドは、次のように指定できます。

PGOPTIONS='-c default_table_access_method=wuzza'

優れた実践

<title>Good Practices</title>

It is very easy to use <application>pgbench</application> to produce completely meaningless numbers. Here are some guidelines to help you get useful results. まったく無意味な数値を生み出すようにpgbenchを使用することは非常に簡単です。 以下に有意な結果を生み出す手助けとなるガイドラインをいくつか示します。

In the first place, <emphasis>never</emphasis> believe any test that runs for only a few seconds. Use the <option>-t</option> or <option>-T</option> option to make the run last at least a few minutes, so as to average out noise. In some cases you could need hours to get numbers that are reproducible. It's a good idea to try the test run a few times, to find out if your numbers are reproducible or not. まず第一に、数秒で終わる試験を決して信用しないでください。 -tまたは-Tオプションを使って、雑音を取り除くために、少なくとも数分試験にかかるようにしてください。 再現可能な数値を得るために数時間必要になる場合もあります。 数回試験を繰り返し、数値が再現できるかどうか確認することを勧めます。

For the default TPC-B-like test scenario, the initialization scale factor (<option>-s</option>) should be at least as large as the largest number of clients you intend to test (<option>-c</option>); else you'll mostly be measuring update contention. There are only <option>-s</option> rows in the <structname>pgbench_branches</structname> table, and every transaction wants to update one of them, so <option>-c</option> values in excess of <option>-s</option> will undoubtedly result in lots of transactions blocked waiting for other transactions. デフォルトのTPC-Bのような試験シナリオでは、初期倍率(-s)を試験予定のクライアント数(-c)の最大値と同程度にしなければなりません。 pgbench_branchesテーブルには-s行しかありません。 また、全トランザクションはその内の1つを更新しようとします。 ですので、-c値を-sより大きくすると、他のトランザクションを待機するためにブロックされるトランザクションが多くなることは間違いありません。

The default test scenario is also quite sensitive to how long it's been since the tables were initialized: accumulation of dead rows and dead space in the tables changes the results. To understand the results you must keep track of the total number of updates and when vacuuming happens. If autovacuum is enabled it can result in unpredictable changes in measured performance. デフォルトの試験シナリオはまた、テーブルを初期化してからの経過時間に非常に敏感です。 テーブル内の不要行や不要空間の累積により結果が変わります。 結果を理解するためには、更新された行数とバキューム時期を把握する必要があります。 自動バキュームが有効な場合、性能を測定する上で結果は予測できないほど変わる可能性があります。

A limitation of <application>pgbench</application> is that it can itself become the bottleneck when trying to test a large number of client sessions. This can be alleviated by running <application>pgbench</application> on a different machine from the database server, although low network latency will be essential. It might even be useful to run several <application>pgbench</application> instances concurrently, on several client machines, against the same database server. pgbenchの制限は、多くのクライアントセッションを試験しようとする際にpgbench自身がボトルネックになる可能性があることです。 これは、データベースサーバとは別のマシンでpgbenchを実行することで緩和させることが可能です。 しかし、多少のネットワーク遅延が重要です。 同一データベースサーバに対し複数のクライアントマシンから複数のpgbenchインスタンスを同時に実行することが有用かもしれません。

セキュリティ

<title>Security</title>

If untrusted users have access to a database that has not adopted a <link linkend="ddl-schemas-patterns">secure schema usage pattern</link>, do not run <application>pgbench</application> in that database. <application>pgbench</application> uses unqualified names and does not manipulate the search path. 安全なスキーマの利用パターンを適用していないデータベースに信頼できないユーザがアクセス可能な場合、そのデータベースでpgbenchを実行しないでください。 pgbenchは修飾していない名前を使っており、またサーチパスを操作していません。