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

20.9. 実行時統計情報 #

<title>Run-time Statistics</title>

20.9.1. 累積的な問い合わせ及びインデックスの統計情報 #

<title>Cumulative Query and Index Statistics</title>

These parameters control the server-wide cumulative statistics system. When enabled, the data that is collected can be accessed via the <structname>pg_stat</structname> and <structname>pg_statio</structname> family of system views. Refer to <xref linkend="monitoring"/> for more information. これらのパラメータは、サーバ全体の累積的な統計情報収集機能を制御します。 統計情報収集が有効ならば、生成されるデータはpg_statpg_statio系のシステムビュー経由でアクセス可能です。 詳細は第28章を参照してください。

track_activities (boolean) #

Enables the collection of information on the currently executing command of each session, along with its identifier and the time when that command began execution. This parameter is on by default. Note that even when enabled, this information is only visible to superusers, roles with privileges of the <literal>pg_read_all_stats</literal> role and the user owning the sessions being reported on (including sessions belonging to a role they have the privileges of), so it should not represent a security risk. Only superusers and users with the appropriate <literal>SET</literal> privilege can change this setting. 各セッションで実行中のコマンドに関する情報と、そのコマンドの識別子および実行開始時刻の収集を有効にします。 このパラメータはデフォルトで有効です。 有効な場合であっても、スーパーユーザ、pg_read_all_statsロール権限を持つロール、報告対象のセッション(権限を持つロールに所属するセッションを含みます)の所有者のみから可視である点に注意してください。 このためセキュリティ上の危険性はありません。 スーパーユーザと、適切なSET権限を持つユーザのみがこの設定を変更することができます。

track_activity_query_size (integer) #

Specifies the amount of memory reserved to store the text of the currently executing command for each active session, for the <structname>pg_stat_activity</structname>.<structfield>query</structfield> field. If this value is specified without units, it is taken as bytes. The default value is 1024 bytes. This parameter can only be set at server start. pg_stat_activity.queryフィールドに対し、それぞれの活動中のセッションで現在実行されているコマンドを追跡記録するため予約されるメモリ量を指定します。 この値が単位なしで指定された場合は、バイト単位であるとみなします。 デフォルトの値は1024バイトです。 このパラメータはサーバ起動時のみ設定可能です。

track_counts (boolean) #

Enables collection of statistics on database activity. This parameter is on by default, because the autovacuum daemon needs the collected information. Only superusers and users with the appropriate <literal>SET</literal> privilege can change this setting. データベースの活動についての統計情報の収集を有効にします。 収集される情報を自動バキュームデーモンが必要とするため、このオプションはデフォルトで有効です。 スーパーユーザと、適切なSET権限を持つユーザのみがこの設定を変更することができます。

track_io_timing (boolean) #

Enables timing of database I/O calls. This parameter is off by default, as it will repeatedly query the operating system for the current time, which may cause significant overhead on some platforms. You can use the <xref linkend="pgtesttiming"/> tool to measure the overhead of timing on your system. I/O timing information is displayed in <link linkend="monitoring-pg-stat-database-view"> <structname>pg_stat_database</structname></link>, in the output of <xref linkend="sql-explain"/> when the <literal>BUFFERS</literal> option is used, in the output of <xref linkend="sql-vacuum"/> when the <literal>VERBOSE</literal> option is used, by autovacuum for auto-vacuums and auto-analyzes, when <xref linkend="guc-log-autovacuum-min-duration"/> is set and by <xref linkend="pgstatstatements"/>. Only superusers and users with the appropriate <literal>SET</literal> privilege can change this setting. データベースによるI/O呼び出しの記録を有効にします。 このパラメータはデフォルトで無効になっています。その理由は、現時点の時刻をオペレーティングシステムに繰り返し問い合わせるので、プラットフォームによっては深刻な負荷の原因になるからです。 使用しているシステムにおける記録の負荷を計測するためpg_test_timingツールが使用できます。 I/O呼び出し情報は、pg_stat_databaseに表示されます。 BUFFERSオプションが設定されている時はEXPLAIN の出力、VERBOSEオプションが設定されている時はVACUUMの出力、log_autovacuum_min_durationが設定されている時はpg_stat_statementsにより表示されます。 スーパーユーザと、適切なSET権限を持つユーザのみがこの設定を変更することができます。

track_wal_io_timing (boolean) #

Enables timing of WAL I/O calls. This parameter is off by default, as it will repeatedly query the operating system for the current time, which may cause significant overhead on some platforms. You can use the <application>pg_test_timing</application> tool to measure the overhead of timing on your system. I/O timing information is displayed in <link linkend="monitoring-pg-stat-wal-view"> <structname>pg_stat_wal</structname></link>. Only superusers and users with the appropriate <literal>SET</literal> privilege can change this setting. データベースによるWAL I/O呼び出しの記録を有効にします。 このパラメータはデフォルトで無効になっています。その理由は、現時点の時刻をオペレーティングシステムに繰り返し問い合わせるので、プラットフォームによっては深刻な負荷の原因になるからです。 使用しているシステムにおける負荷のタイミングを計測するためpg_test_timingツールが使用できます。 I/O呼び出し情報は、pg_stat_walに表示されます。 スーパーユーザと、適切なSET権限を持つユーザのみがこの設定を変更することができます。

track_functions (enum) #

Enables tracking of function call counts and time used. Specify <literal>pl</literal> to track only procedural-language functions, <literal>all</literal> to also track SQL and C language functions. The default is <literal>none</literal>, which disables function statistics tracking. Only superusers and users with the appropriate <literal>SET</literal> privilege can change this setting. 関数の呼び出し数と費やされた時間の追跡を有効にします。 手続き言語関数のみを追跡するためにはplと指定してください。 SQL関数、C言語関数も追跡するためにはallと指定してください。 デフォルトは、統計情報追跡機能を無効にするnoneです。 スーパーユーザと、適切なSET権限を持つユーザのみがこの設定を変更することができます。

注記

SQL-language functions that are simple enough to be <quote>inlined</quote> into the calling query will not be tracked, regardless of this setting. 呼び出す問い合わせ内にインライン化できる位単純なSQL言語関数は、この設定と関係なく、追跡されません。

stats_fetch_consistency (enum) #

Determines the behavior when cumulative statistics are accessed multiple times within a transaction. When set to <literal>none</literal>, each access re-fetches counters from shared memory. When set to <literal>cache</literal>, the first access to statistics for an object caches those statistics until the end of the transaction unless <function>pg_stat_clear_snapshot()</function> is called. When set to <literal>snapshot</literal>, the first statistics access caches all statistics accessible in the current database, until the end of the transaction unless <function>pg_stat_clear_snapshot()</function> is called. Changing this parameter in a transaction discards the statistics snapshot. The default is <literal>cache</literal>. トランザクション内で累積的統計に複数回アクセスする場合の動作を決定します。 noneに設定すると、各アクセスは共有メモリからカウンタを再フェッチします。 cacheに設定すると、オブジェクトの統計への最初のアクセスは、pg_stat_clear_snapshot()が呼び出されない限り、トランザクションが終了するまでこれらの統計をキャッシュします。 snapshotに設定すると、最初の統計アクセスは、pg_stat_clear_snapshot()が呼び出されない限り、トランザクションが終了するまで現在のデータベースでアクセス可能なすべての統計をキャッシュします。 トランザクション内でこのパラメータを変更すると、統計情報のスナップショットは破棄されます。 デフォルトはcacheです。

注記

<literal>none</literal> is most suitable for monitoring systems. If values are only accessed once, it is the most efficient. <literal>cache</literal> ensures repeat accesses yield the same values, which is important for queries involving e.g. self-joins. <literal>snapshot</literal> can be useful when interactively inspecting statistics, but has higher overhead, particularly if many database objects exist. noneは、システムの監視に最も適しています。 値が一度しかアクセスされない場合、最も効率的です。 cacheは、繰り返しアクセスによって同じ値が生成されることを保証します。 これは、自己結合などを含むクエリで重要です。 snapshotは、統計情報を対話的に検査する場合に便利ですが、特に多くのデータベースオブジェクトが存在する場合にはオーバーヘッドが高くなります。

20.9.2. 統計情報の監視 #

<title>Statistics Monitoring</title>
compute_query_id (enum) #

Enables in-core computation of a query identifier. Query identifiers can be displayed in the <link linkend="monitoring-pg-stat-activity-view"><structname>pg_stat_activity</structname></link> view, using <command>EXPLAIN</command>, or emitted in the log if configured via the <xref linkend="guc-log-line-prefix"/> parameter. The <xref linkend="pgstatstatements"/> extension also requires a query identifier to be computed. Note that an external module can alternatively be used if the in-core query identifier computation method is not acceptable. In this case, in-core computation must be always disabled. Valid values are <literal>off</literal> (always disabled), <literal>on</literal> (always enabled), <literal>auto</literal>, which lets modules such as <xref linkend="pgstatstatements"/> automatically enable it, and <literal>regress</literal> which has the same effect as <literal>auto</literal>, except that the query identifier is not shown in the <literal>EXPLAIN</literal> output in order to facilitate automated regression testing. The default is <literal>auto</literal>. 組み込みの問い合わせ識別子の計算を有効にします。 問い合わせ識別子は、pg_stat_activityビュー、EXPLAIN、あるいはlog_line_prefixパラメータが設定されていればログに出力されます。 pg_stat_statements拡張も問い合わせ識別子の計算が必要です。 組み込みの計算が許容できなければ、外部モジュールを代わりに利用することができることに注意してください。 この場合、組み込みの計算は常に無効にしなければなりません。 有効な値は、off(常に無効)、on(常に有効)、pg_stat_statementsのようなモジュールによって自動的に有効になるauto、自動リグレッションテストを機能させるために、問い合わせ識別子がEXPLAIN出力に表示されないことを除けばautoと同じ効果を持つregressです。 デフォルトはautoです。

注記

To ensure that only one query identifier is calculated and displayed, extensions that calculate query identifiers should throw an error if a query identifier has already been computed. 一つの問い合わせ識別子のみが計算されて表示されることを確実にするために、問い合わせ識別子を計算する拡張は、問い合わせ識別子がすでに計算済みのときにエラーを生じるようにすべきです。

log_statement_stats (boolean)
log_parser_stats (boolean)
log_planner_stats (boolean)
log_executor_stats (boolean) #

For each query, output performance statistics of the respective module to the server log. This is a crude profiling instrument, similar to the Unix <function>getrusage()</function> operating system facility. <varname>log_statement_stats</varname> reports total statement statistics, while the others report per-module statistics. <varname>log_statement_stats</varname> cannot be enabled together with any of the per-module options. All of these options are disabled by default. Only superusers and users with the appropriate <literal>SET</literal> privilege can change these settings. 各問い合わせに対し、対応するモジュールの性能に関する統計情報をサーバログに出力します。 これは、Unixのgetrusage()オペレーティングシステム機能に類似した、雑なプロファイリング手段です。 log_statement_statsは文に関する統計情報全体を、この他はモジュール毎の統計情報を報告します。 log_statement_statsとモジュール毎のオプションを一緒に有効にすることはできません。 デフォルトでこれらのオプションはすべて無効です。 スーパーユーザと、適切なSET権限を持つユーザのみがこの設定を変更することができます。