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

54.27. pg_stats #

The view <structname>pg_stats</structname> provides access to the information stored in the <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> catalog. This view allows access only to rows of <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> that correspond to tables the user has permission to read, and therefore it is safe to allow public read access to this view. pg_statsビューはpg_statisticカタログの情報にアクセスするためのビューです。 このビューは、ユーザが読み込み権限を持つテーブルに一致するpg_statisticの行に対してのみアクセスを許可しています。 よって、このビューに対して一般に読み込みを許可しても安全です。

<structname>pg_stats</structname> is also designed to present the information in a more readable format than the underlying catalog &mdash; at the cost that its schema must be extended whenever new slot types are defined for <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>. pg_statsも、その基礎となっているカタログよりも、より読みやすい書式で情報を提供するように設計されています。 しかし、これは、もしpg_statisticに対して新しいスロット型が定義されるたびに、スキーマが拡張されなくてはならない、という犠牲を払っています。

表54.27 pg_statsの列

<title><structname>pg_stats</structname> Columns</title>

Column Type 列 型

Description 説明

schemaname name (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>) (参照先 pg_namespace.nspname

Name of schema containing table テーブルがあるスキーマの名前

tablename name (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>) (参照先 pg_class.relname

Name of table テーブルの名前

attname name (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>) (参照先 pg_attribute.attname

Name of column described by this row この行が記述する列名

inherited bool

If true, this row includes values from child tables, not just the values in the specified table trueの場合は、この行には指定されたテーブルの値だけではなく、子テーブルの値が含まれます

null_frac float4

Fraction of column entries that are null NULLとなっている列項目の割合

avg_width int4

Average width in bytes of column's entries 列項目のバイト単位による平均幅

n_distinct float4

If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when <command>ANALYZE</command> believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows. ゼロより大きい値は列内の個別値の推定数です。 ゼロより小さければ行数で個別値を割算した数字の負数です。 (テーブルが肥大するにつれ個別値の増大があり得るとANALYZEが判断した場合に負変換形式が使われます。 正変換形式は列の取り得る値が固定数を持つと思われる場合に使用されます)。 例えば-1は個別値の数が行数と等しいような、一意な列を表します。

most_common_vals anyarray

A list of the most common values in the column. (Null if no values seem to be more common than any others.) 列の中の最も共通した値のリストです(他の値よりもより共通している値がない場合はNULLです)。

most_common_freqs float4[]

A list of the frequencies of the most common values, i.e., number of occurrences of each divided by total number of rows. (Null when <structfield>most_common_vals</structfield> is.) 最も一般的な値の出現頻度のリストで、つまり行の総数で出現数を割算した数字です(most_common_valsがNULLの時はNULLです)。

histogram_bounds anyarray

A list of values that divide the column's values into groups of approximately equal population. The values in <structfield>most_common_vals</structfield>, if present, are omitted from this histogram calculation. (This column is null if the column data type does not have a <literal>&lt;</literal> operator or if the <structfield>most_common_vals</structfield> list accounts for the entire population.) 列の値を満遍なく似たような数でグループに分配した値のリストです。 most_common_valsの値がもし存在すればこのヒストグラム計算は行われません。 (列データ型が<演算子を所有しない場合、もしくはmost_common_valsが全体の構成要素アカウントをリストしている場合、この列はNULLです)。

correlation float4

Statistical correlation between physical row ordering and logical ordering of the column values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the column will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This column is null if the column data type does not have a <literal>&lt;</literal> operator.) 物理的な[訳注:ディスク上の]行の並び順と論理的な列の値の並び順に関する統計的相関です。 この値は-1から+1の範囲です。 値が-1もしくは+1の近辺にある時、ディスクにランダムアクセスする必要が少なくなるためこの列に対してのインデックススキャンはゼロ近辺にある場合に比較して安価であると推定されます。 (列データ型に<演算子がない場合、この列はNULLです)。

most_common_elems anyarray

A list of non-null element values most often appearing within values of the column. (Null for scalar types.) 列の値の中で最もよく出現する非NULLの要素値のリストです。(スカラ型の場合はNULLです。)

most_common_elem_freqs float4[]

A list of the frequencies of the most common element values, i.e., the fraction of rows containing at least one instance of the given value. Two or three additional values follow the per-element frequencies; these are the minimum and maximum of the preceding per-element frequencies, and optionally the frequency of null elements. (Null when <structfield>most_common_elems</structfield> is.) 最も一般的な要素値の出現頻度のリストで、与えられた値の少なくとも1つのインスタンスを含む行の断片です。 2つもしくは3つの追加の値が1つの要素ごとの出現頻度に続きます。 最小で最大の要素ごとの出現頻度があります。さらにオプションとしてNULL要素の出現頻度もあります。 (most_common_elemsがNULLの時はNULLです。)

elem_count_histogram float4[]

A histogram of the counts of distinct non-null element values within the values of the column, followed by the average number of distinct non-null elements. (Null for scalar types.) 列の値でNULLではない要素値の個別数のヒストグラム。これは個別のNULLではない平均値が後に続きます。(スカラ型の場合はNULLです。)


The maximum number of entries in the array fields can be controlled on a column-by-column basis using the <link linkend="sql-altertable"><command>ALTER TABLE SET STATISTICS</command></link> command, or globally by setting the <xref linkend="guc-default-statistics-target"/> run-time parameter. 配列の最大項目数はALTER TABLE SET STATISTICSコマンドで列ごとに設定されるか、もしくはdefault_statistics_target実行時パラメータで包括的に設定されるかのいずれかです。