|
10 | 10 | while producing statistics, the results will change slightly after |
11 | 11 | any new <command>ANALYZE</command>. |
12 | 12 | </span> |
13 | | -《マッチ度[55.755396]》以下の例は<span class="productname">PostgreSQL</span>リグレッションテストデータベース内のテーブルを使用します。 |
14 | | -表示される出力はバージョン8.3で取得しました。 |
15 | | -以前の(または以降の)バージョンとは動作が変わっているかもしれません。 |
16 | | -また、<code class="command">ANALYZE</code>は統計情報を生成する時にランダムなサンプリングを行いますので、結果は<code class="command">ANALYZE</code>を新しく行った後に多少変わることに注意してください。 |
17 | | -《機械翻訳》以下の例は<span class="productname">PostgreSQL</span>リグレッションテストデータベースのテーブルを使用しています。 |
| 13 | +以下の例は<span class="productname">PostgreSQL</span>リグレッションテストデータベースのテーブルを使用しています。 |
18 | 14 | また、<code class="command">ANALYZE</code>は統計を生成する際にランダムサンプリングを使用するため、新しい<code class="command">ANALYZE</code>を実行した後は結果がわずかに変化することに注意してください。 |
19 | 15 | </p><p> |
20 | 16 | <span class="original"> |
|
36 | 32 | completeness. The number of pages and rows is looked up in |
37 | 33 | <structname>pg_class</structname>: |
38 | 34 | </span> |
39 | | -プランナがどのように<code class="structname">tenk1</code>の濃度を決定するかについては<a class="xref" href="planner-stats.html" title="14.2. プランナで使用される統計情報">14.2</a>で説明しました。 |
| 35 | +プランナがどのように<code class="structname">tenk1</code>のカーディナリティを決定するかについては<a class="xref" href="planner-stats.html" title="14.2. プランナで使用される統計情報">14.2</a>で説明しました。 |
40 | 36 | しかし、ここでは完全を期するために説明を繰り返します。 |
41 | 37 | ページ数および行数は<code class="structname">pg_class</code>から検索されます。 |
42 | 38 |
|
|
137 | 133 | <structname>tenk1</structname>: |
138 | 134 | </span> |
139 | 135 | つまり、1つのバケット全体に、2番目のバケットとの線形比率を加えたものを、バケット数で割ったものとなります。 |
140 | | -ここで、行の推定値は、選択度と<code class="structname">tenk1</code>の濃度を掛け合わせたものとして計算されます。 |
| 136 | +ここで、行の推定値は、選択度と<code class="structname">tenk1</code>のカーディナリティを掛け合わせたものとして計算されます。 |
141 | 137 |
|
142 | 138 | </p><pre class="programlisting"> |
143 | 139 | rows = rel_cardinality * selectivity |
|
205 | 201 | As before, the estimated number of rows is just the product of this with the |
206 | 202 | cardinality of <structname>tenk1</structname>: |
207 | 203 | </span> |
208 | | -前と同様、推定される行数は単に前回同様、この値と<code class="structname">tenk1</code>の濃度との積です。 |
| 204 | +前と同様、推定される行数は単に前回同様、この値と<code class="structname">tenk1</code>のカーディナリティとの積です。 |
209 | 205 |
|
210 | 206 | </p><pre class="programlisting"> |
211 | 207 | rows = 10000 * 0.003 |
|
502 | 498 | count estimates for both relations (num_rows, not shown, but "tenk") |
503 | 499 | together with the column null fractions (zero for both): |
504 | 500 | </span> |
505 | | -《マッチ度[62.269939]》今回の場合、すべての値が一意であるため、<code class="structfield">unique2</code>に関する<acronym class="acronym">MCV</acronym>情報がありません。 |
506 | | -ですので、両リレーションの個別値数とNULL値の部分のみに依存したアルゴリズムを使用することができます。 |
507 | | -《機械翻訳》この場合、<code class="structname">unique2</code>に対する<acronym class="acronym">MCV</acronym>情報は存在せず、すべての値は一意であるように見えます(n_distinct = -1)。 |
508 | | -そこで、両方の関係(num_rows、図示せず、ただし"tenk")に対する行数の推定値と列のNULL部分(両方ともゼロ)を使用するアルゴリズムを使用します。 |
| 501 | +この場合、<code class="structname">unique2</code>に関する<acronym class="acronym">MCV</acronym>の情報はなく、すべての値が一意であるように見えます(n_distinct = -1)。 |
| 502 | +そのため、両方のリレーションの行数推定値((ここでは表示されていませんが"tenk"の)num_rows)と、列のNULL率(両方ともゼロ)に基づいたアルゴリズムが使用されます。 |
509 | 503 |
|
510 | 504 | </p><pre class="programlisting"> |
511 | 505 | selectivity = (1 - null_frac1) * (1 - null_frac2) / max(num_rows1, num_rows2) |
|
522 | 516 | Cartesian product of the two inputs, multiplied by the |
523 | 517 | selectivity: |
524 | 518 | </span> |
525 | | -《マッチ度[76.946108]》これは、各リレーションにおいて、1からNULL部分を差し引き、個別値数の最大値で割った値です。 |
526 | | -この結合が生成するはずの行数は、2つの入力のデカルト積の濃度に、この選択度を掛けたものとして計算されます。 |
527 | | -《機械翻訳》これは、各リレーションに対してNULL分数を1から減算し、より大きなリレーションの行カウントで割った値です(この値は、一意でない場合にスケーリングされます)。 |
528 | | -結合が発行する可能性のある行数は、2つの入力の直積のカーディナリティに選択性を掛けたものとして計算されます。 |
| 519 | +これは、各リレーションにおいて、1からNULL部分を差し引き、それを大きい方のリレーションの行数で割ります(この値は一意でない場合にはスケーリングされます)。 |
| 520 | +この結合が生成するはずの行数は、2つの入力のデカルト積のカーディナリティに、この選択度を掛けたものとして計算されます。 |
529 | 521 |
|
530 | 522 | </p><pre class="programlisting"> |
531 | 523 | rows = (outer_cardinality * inner_cardinality) * selectivity |
|
0 commit comments