-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog-pg-statistic.html
More file actions
100 lines (100 loc) · 14.6 KB
/
Copy pathcatalog-pg-statistic.html
File metadata and controls
100 lines (100 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>49.45. pg_statistic</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PostgreSQL 9.5.4文書" /><link rel="up" href="catalogs.html" title="第49章 システムカタログ" /><link rel="prev" href="catalog-pg-shseclabel.html" title="49.44. pg_shseclabel" /><link rel="next" href="catalog-pg-tablespace.html" title="49.46. pg_tablespace" /><link rel="copyright" href="legalnotice.html" title="法的告知" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><td width="20%" align="left" colspan="2"></td><th width="60%" align="center"><a accesskey="h" href="index.html">PostgreSQL 9.5.4文書</a></th><td width="20%" align="right"><div class="actions"><a class="issue" href="https://github.com/pgsql-jp/jpug-doc/issues/new?title=version 9.5.4 catalog-pg-statistic.html">誤訳等の報告</a></div></td></tr><tr><td width="10%" align="left" valign="top"><a accesskey="p" href="catalog-pg-shseclabel.html">前へ</a> </td><td width="10%" align="left" valign="top"><a accesskey="u" href="catalogs.html">上へ</a></td><td width="60%" align="center">49.45. <code class="structname">pg_statistic</code></td><td width="20%" align="right" valign="top"> <a accesskey="n" href="catalog-pg-tablespace.html">次へ</a></td></tr></table><hr /></div><div class="sect1" id="catalog-pg-statistic"><div class="titlepage"><div><div><h2 class="title" style="clear: both">49.45. <code class="structname">pg_statistic</code></h2></div></div></div><a id="idp112996896" class="indexterm"></a><p><span class="original">
The catalog <structname>pg_statistic</structname> stores
statistical data about the contents of the database. Entries are
created by <xref linkend="sql-analyze">
and subsequently used by the query planner. Note that all the
statistical data is inherently approximate, even assuming that it
is up-to-date.
</span><code class="structname">pg_statistic</code>カタログはデータベースの内容に関する統計データを保存します。
項目は<a class="xref" href="sql-analyze.html" title="ANALYZE"><span class="refentrytitle">ANALYZE</span></a>で作成され、後に問い合わせプランナで使用されます。
最新のものと思ってもすべての統計データは本質的に大雑把なものであることに注意してください。
</p><p><span class="original">
Normally there is one entry, with <structfield>stainherit</> =
<literal>false</>, for each table column that has been analyzed.
If the table has inheritance children, a second entry with
<structfield>stainherit</> = <literal>true</> is also created. This row
represents the column's statistics over the inheritance tree, i.e.,
statistics for the data you'd see with
<literal>SELECT <replaceable>column</> FROM <replaceable>table</>*</literal>,
whereas the <structfield>stainherit</> = <literal>false</> row represents
the results of
<literal>SELECT <replaceable>column</> FROM ONLY <replaceable>table</></literal>.
</span>通常は、解析されるテーブル列毎に、<code class="structfield">stainherit</code> = <code class="literal">false</code>を持つ1つの項目が存在します。
テーブルが継承された子を持つ場合、<code class="structfield">stainherit</code> = <code class="literal">true</code>を持つ2つ目の項目が作成されます。
この行は継承ツリー全体に渡る列の統計情報、つまり、<code class="literal">SELECT <em class="replaceable"><code>column</code></em> FROM <em class="replaceable"><code>table</code></em>*</code>で確認できるデータに対する統計情報を表します。
一方で<code class="structfield">stainherit</code> = <code class="literal">false</code>の行は<code class="literal">SELECT <em class="replaceable"><code>column</code></em> FROM ONLY <em class="replaceable"><code>table</code></em></code>の結果を表します。
</p><p><span class="original">
<structname>pg_statistic</structname> also stores statistical data about
the values of index expressions. These are described as if they were
actual data columns; in particular, <structfield>starelid</structfield>
references the index. No entry is made for an ordinary non-expression
index column, however, since it would be redundant with the entry
for the underlying table column. Currently, entries for index expressions
always have <structfield>stainherit</> = <literal>false</>.
</span><code class="structname">pg_statistic</code>はインデックス式の値についての統計データも格納します。
これらはあたかも値が実際のデータ列であるかのように表現されます。
特に<code class="structfield">starelid</code>はインデックスを参照します。
これは元のテーブル列の項目に対して冗長となるので、普通の式を持たないインデックス列では項目は作成されません。
現在インデックス式用の項目は常に<code class="structfield">stainherit</code> = <code class="literal">false</code>を持ちます。
</p><p><span class="original">
Since different kinds of statistics might be appropriate for different
kinds of data, <structname>pg_statistic</structname> is designed not
to assume very much about what sort of statistics it stores. Only
extremely general statistics (such as nullness) are given dedicated
columns in <structname>pg_statistic</structname>. Everything else
is stored in <quote>slots</quote>, which are groups of associated columns
whose content is identified by a code number in one of the slot's columns.
For more information see
<filename>src/include/catalog/pg_statistic.h</filename>.
</span>異なる種類のデータに対しては違った種類の統計が相応しいことから<code class="structname">pg_statistic</code>はどのような情報を保存するか深く推定しないように設計されています。
(例えばNULLであるような)極端に一般的な統計のみ<code class="structname">pg_statistic</code>の特定の列に入ります。
その他すべてはスロット列の内の1つのコード番号でその内容が識別される相関している列のグループである<span class="quote">「<span class="quote">スロット</span>」</span>に保存されます。
<code class="filename">src/include/catalog/pg_statistic.h</code>を参照してください。
</p><p><span class="original">
<structname>pg_statistic</structname> should not be readable by the
public, since even statistical information about a table's contents
might be considered sensitive. (Example: minimum and maximum values
of a salary column might be quite interesting.)
<link linkend="view-pg-stats"><structname>pg_stats</structname></link>
is a publicly readable view on
<structname>pg_statistic</structname> that only exposes information
about those tables that are readable by the current user.
</span><code class="structname">pg_statistic</code>はテーブル内容に関する統計情報と言えども秘密の情報とみなされますので、一般のユーザが読み取り可能であってはいけません。
(給与列の最高額と最低額などは誰もが興味をそそる良い例ですよね。)
<a class="link" href="view-pg-stats.html" title="49.75. pg_stats"><code class="structname">pg_stats</code></a>は一般のユーザが読み取り可能な<code class="structname">pg_statistic</code>に対するビューで、既存のユーザが読んでも差し支えないテーブルの情報のみを開示しています。
</p><div class="table" id="idp113017520"><p class="title"><strong>表49.45 <code class="structname">pg_statistic</code>の列</strong></p><div class="table-contents"><span class="original">
<title><structname>pg_statistic</> Columns</title>
</span><table summary="pg_statisticの列" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>名前</th><th>型</th><th>参照先</th><th>説明</th></tr></thead><tbody><tr><td><code class="structfield">starelid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="49.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>記述された列が属するテーブルもしくはインデックス</td></tr><tr><td><code class="structfield">staattnum</code></td><td><code class="type">int2</code></td><td><code class="literal"><a class="link" href="catalog-pg-attribute.html" title="49.7. pg_attribute"><code class="structname">pg_attribute</code></a>.attnum</code></td><td>記述された列数</td></tr><tr><td><code class="structfield">stainherit</code></td><td><code class="type">bool</code></td><td> </td><td>真の場合、統計情報には指定されたテーブルの値だけではなく、継承関係の子の列が含まれます。
</td></tr><tr><td><code class="structfield">stanullfrac</code></td><td><code class="type">float4</code></td><td> </td><td>NULL値である列項目の割合</td></tr><tr><td><code class="structfield">stawidth</code></td><td><code class="type">int4</code></td><td> </td><td>非NULL項目の平均保存幅(バイト単位)</td></tr><tr><td><code class="structfield">stadistinct</code></td><td><code class="type">float4</code></td><td> </td><td>列内で非NULL個別値を持つデータ数。
ゼロより大きい値は実際の個別値の数です。
ゼロより小さい値はテーブル内の行数に対する乗数を負にしたものです。
例えば、約80%の値が非NULLで、それぞれの非NULL値が平均して2回ほど出現する列は<code class="structfield">stadistinct</code> = -0.4であると表現されます。
ゼロは個別値の数を特定できない場合です。
</td></tr><tr><td><code class="structfield">stakind<em class="replaceable"><code>N</code></em></code></td><td><code class="type">int2</code></td><td> </td><td><span class="original">
A code number indicating the kind of statistics stored in the
<replaceable>N</>th <quote>slot</quote> of the
<structname>pg_statistic</structname> row.
</span> <code class="structname">pg_statistic</code>行のN番目の<span class="quote">「<span class="quote">スロット</span>」</span>に保存されている統計情報の種類を示すコード番号。
</td></tr><tr><td><code class="structfield">staop<em class="replaceable"><code>N</code></em></code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-operator.html" title="49.33. pg_operator"><code class="structname">pg_operator</code></a>.oid</code></td><td><span class="original">
An operator used to derive the statistics stored in the
<replaceable>N</>th <quote>slot</quote>. For example, a
histogram slot would show the <literal>&lt;</literal> operator
that defines the sort order of the data.
</span>N番目の<span class="quote">「<span class="quote">スロット</span>」</span>に保存されている統計情報を引き出すために使われる演算子。
例えば、度数分布スロットはデータの並び換えの順序を定義する<code class="literal"><</code>演算子を示します。
</td></tr><tr><td><code class="structfield">stanumbers<em class="replaceable"><code>N</code></em></code></td><td><code class="type">float4[]</code></td><td> </td><td><span class="original">
Numerical statistics of the appropriate kind for the
<replaceable>N</>th <quote>slot</quote>, or null if the slot
kind does not involve numerical values
</span> N番目の<span class="quote">「<span class="quote">スロット</span>」</span>に対する適切な種類の数値統計情報、もしくはスロットの種類に数値が含まれない時はNULLです。
</td></tr><tr><td><code class="structfield">stavalues<em class="replaceable"><code>N</code></em></code></td><td><code class="type">anyarray</code></td><td> </td><td><span class="original">
Column data values of the appropriate kind for the
<replaceable>N</>th <quote>slot</quote>, or null if the slot
kind does not store any data values. Each array's element
values are actually of the specific column's data type, or a related
type such as an array's element type, so there is no way to define
these columns' type more specifically than <type>anyarray</>.
</span><em class="replaceable"><code>N</code></em>番目の<span class="quote">「<span class="quote">スロット</span>」</span>に対する適切な種類の列データの値、もしくはスロットの種類にデータ値が何も保存されていない場合はNULL。
それぞれの配列要素の値は実際には特定された列のデータ型、もしくは配列要素の型といったような関連のある型になります。ですから<code class="type">anyarray</code>とする以外に列型を定義することはできません。
</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-shseclabel.html">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-tablespace.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">49.44. <code class="structname">pg_shseclabel</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">ホーム</a></td><td width="40%" align="right" valign="top"> 49.46. <code class="structname">pg_tablespace</code></td></tr></table></div></body></html>