-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrin-intro.html
More file actions
164 lines (164 loc) · 15.9 KB
/
brin-intro.html
File metadata and controls
164 lines (164 loc) · 15.9 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?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>71.1. はじめに</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="brin.html" title="第71章 BRINインデックス" /><link rel="next" href="brin-builtin-opclasses.html" title="71.2. 組み込み演算子クラス" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 16.0文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="brin.html" title="第71章 BRINインデックス">第71章 BRINインデックス</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 16.0 : brin-intro.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="brin.html" title="第71章 BRINインデックス">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="brin.html" title="第71章 BRINインデックス">上へ</a></td><td width="60%" align="center">71.1. はじめに</td><td width="20%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html" title="71.2. 組み込み演算子クラス">次へ</a></td></tr></table><hr /></div><div class="sect1" id="BRIN-INTRO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">71.1. はじめに <a href="#BRIN-INTRO" class="id_link">#</a></h2></div></div></div><span class="original">
<title>Introduction</title>
</span><p>
<span class="original">
<acronym>BRIN</acronym> stands for Block Range Index.
<acronym>BRIN</acronym> is designed for handling very large tables
in which certain columns have some natural correlation with their
physical location within the table.
</span>
<acronym class="acronym">BRIN</acronym>は「ブロックレンジインデックス」(Block Range Index)の略です。
<acronym class="acronym">BRIN</acronym>は、ある列がテーブル内の物理的な位置と自然な相関があるような、非常に大規模なテーブルのために設計されています。
</p><p>
<span class="original">
<acronym>BRIN</acronym> works in terms of <firstterm>block ranges</firstterm>
(or <quote>page ranges</quote>).
A block range is a group of pages that are physically
adjacent in the table; for each block range, some summary info is stored
by the index.
For example, a table storing a store's sale orders might have
a date column on which each order was placed, and most of the time
the entries for earlier orders will appear earlier in the table as well;
a table storing a ZIP code column might have all codes for a city
grouped together naturally.
</span>
<acronym class="acronym">BRIN</acronym>は<em class="firstterm">ブロックレンジ(block range)</em>(または<span class="quote">「<span class="quote">ページレンジ(page range)</span>」</span>)として動作します。
<em class="firstterm">ブロックレンジ(block range)</em>は、テーブル内で物理的に隣接するページのグループです。それぞれのブロックレンジに対して、ある種の要約情報がインデックス内に格納されます。
たとえば、店舗の受注情報を格納するテーブルは、各々の受注時期を格納する日付列を持つでしょう。大抵の場合、より前の受注エントリは、テーブルのより前の方にあるでしょう。
郵便番号を管理するテーブルでは、ある市に属する郵便番号が自然にグループ化されることになるでしょう。
</p><p>
<span class="original">
<acronym>BRIN</acronym> indexes can satisfy queries via regular bitmap
index scans, and will return all tuples in all pages within each range if
the summary info stored by the index is <firstterm>consistent</firstterm> with the
query conditions.
The query executor is in charge of rechecking these tuples and discarding
those that do not match the query conditions &mdash; in other words, these
indexes are lossy.
Because a <acronym>BRIN</acronym> index is very small, scanning the index
adds little overhead compared to a sequential scan, but may avoid scanning
large parts of the table that are known not to contain matching tuples.
</span>
<acronym class="acronym">BRIN</acronym>インデックスは、通常のビットマップインデックススキャンを通じて要求されるクエリに使用することができます。
すなわち、インデックス内のレンジ要約情報が検索条件と<em class="firstterm">一致</em>すれば、<acronym class="acronym">BRIN</acronym>インデックスは、レンジ内の全タプルを返します。
クエリエグゼキュータの役割は、検索条件を再チェックし、条件に合致しないタプルを捨てることです。
つまり言い換えると、<acronym class="acronym">BRIN</acronym>インデックスには損失性があります。
<acronym class="acronym">BRIN</acronym>インデックスは非常に小さいため、それに対するスキャンは順スキャンに比べると小さなオーバーヘッドしか与えません。しかし、あらかじめ条件に合致しないと分かっているテーブルの多くの部分をスキャンすることを避けることができます。
</p><p>
<span class="original">
The specific data that a <acronym>BRIN</acronym> index will store,
as well as the specific queries that the index will be able to satisfy,
depend on the operator class selected for each column of the index.
Data types having a linear sort order can have operator classes that
store the minimum and maximum value within each block range, for instance;
geometrical types might store the bounding box for all the objects
in the block range.
</span>
<acronym class="acronym">BRIN</acronym>インデックスに格納される特定のデータと、そのインデックスが対応できる特定のクエリは、インデックスに対応する各々の列に与えられた演算子クラスに依存します。
線形のソート順を持つデータ型は、ブロックレンジ内の最小値と最大値と格納する演算子クラスを持つことができます。
たとえば、幾何データ型は、ブロックレンジ内のすべてのオブジェクトを含む外接矩形を持つことでしょう。
</p><p>
<span class="original">
The size of the block range is determined at index creation time by
the <literal>pages_per_range</literal> storage parameter. The number of index
entries will be equal to the size of the relation in pages divided by
the selected value for <literal>pages_per_range</literal>. Therefore, the smaller
the number, the larger the index becomes (because of the need to
store more index entries), but at the same time the summary data stored can
be more precise and more data blocks can be skipped during an index scan.
</span>
ブロックレンジの大きさは、ストレージパラメータ<code class="literal">pages_per_range</code>でインデックス作成時に決定されます。
インデックスエントリの数は、リレーションのページ数を<code class="literal">pages_per_range</code>に設定した数で割ったものと等しくなります。
ですから、<code class="literal">pages_per_range</code>の設定値が小さいほど、インデックスは大きくなります(より多くのインデックスエントリを格納する必要があるので)が、反面、格納されたサマリーデータはより精密になり、インデックススキャンの際により多くのデータブロックをスキップすることができるようになります。
</p><div class="sect2" id="BRIN-OPERATION"><div class="titlepage"><div><div><h3 class="title">71.1.1. インデックスの保守 <a href="#BRIN-OPERATION" class="id_link">#</a></h3></div></div></div><span class="original">
<title>Index Maintenance</title>
</span><p>
<span class="original">
At the time of creation, all existing heap pages are scanned and a
summary index tuple is created for each range, including the
possibly-incomplete range at the end.
As new pages are filled with data, page ranges that are already
summarized will cause the summary information to be updated with data
from the new tuples.
When a new page is created that does not fall within the last
summarized range, the range that the new page belongs to
does not automatically acquire a summary tuple;
those tuples remain unsummarized until a summarization run is
invoked later, creating the initial summary for that range.
</span>
インデックスを作成した当初は、すべてのヒープページがスキャンされ、終端が不完全なものも含め、各々のレンジに対してサマリーインデックスタプルが作成されます。
新しいページにデータが登録されると、新しいタプルのデータを元に、すでにサマリー済みのページレンジのサマリー情報が更新されます。
最終サマリーレンジに適合しない新しいページが作成されると、そのレンジに対して自動的にはサマリータプルが作成されません。
これらのタプルは、後でサマリー処理が走って初期サマリー情報が作成されるまではサマリーされません。
</p><p>
<span class="original">
There are several ways to trigger the initial summarization of a page range.
If the table is vacuumed, either manually or by
<link linkend="autovacuum">autovacuum</link>, all existing unsummarized
page ranges are summarized.
Also, if the index's
<xref linkend="index-reloption-autosummarize"/> parameter is enabled,
which it isn't by default,
whenever autovacuum runs in that database, summarization will occur for all
unsummarized page ranges that have been filled,
regardless of whether the table itself is processed by autovacuum; see below.
</span>
ページレンジの初期サマリー処理を起動する複数の方法があります。
手動あるいは<a class="link" href="routine-vacuuming.html#AUTOVACUUM" title="25.1.6. 自動バキュームデーモン">autovacuum</a>のどちらでも良いですが、テーブルがバキュームされるとすべてのまだサマライズされていないページレンジがサマライズされます。
また、インデックスの<a class="xref" href="sql-createindex.html#INDEX-RELOPTION-AUTOSUMMARIZE">autosummarize</a>パラメータが有効なら、これはデフォルトでは有効ではありませんが、そのデータベースに対してバキュームが実行されると、自動バキュームによってそのテーブル自体が処理されるかどうかにかかわらず、すべての挿入された未サマリーページレンジに対してサマリー処理が実行されます。
以下を見てください。
</p><p>
<span class="original">
Lastly, the following functions can be used:
</span>
最後に、次の関数が利用できます。
</p><table border="0" summary="Simple list" class="simplelist"><tr><td>
<span class="original">
<function>brin_summarize_new_values(regclass)</function>
which summarizes all unsummarized ranges;
</span>
すべての未サマリーレンジをサマライズする<code class="function">brin_summarize_new_values(regclass)</code>
</td></tr><tr><td>
<span class="original">
<function>brin_summarize_range(regclass, bigint)</function>
which summarizes only the range containing the given page,
if it is unsummarized.
</span>
もしまだサマライズされていなければ、指定されたページを含む指定されたレンジのみをサマライズする<code class="function">brin_summarize_range(regclass, bigint)</code>
</td></tr></table><p>
</p><p>
<span class="original">
When autosummarization is enabled, a request is sent to
<literal>autovacuum</literal> to execute a targeted summarization
for a block range when an insertion is detected for the first item
of the first page of the next block range,
to be fulfilled the next time an autovacuum
worker finishes running in the
same database. If the request queue is full, the request is not recorded
and a message is sent to the server log:
</span>
自動サマリー機能が有効な場合、次のブロックレンジの最初のページの最初の項目の挿入が検出されると、同じデータベースで実行中の自動バキュームワーカーの次の実行の終了時に処理されるブロックレンジをターゲットとするサマリー機能を実行する要求が<code class="literal">autovacuum</code>に送信されます。
もしリクエストキューが満杯ならばそのリクエストは記録されず、次のメッセージがサーバのログに送信されます。
</p><pre class="screen">
LOG: request for BRIN range summarization for index "brin_wi_idx" page 128 was not recorded
</pre><p>
<span class="original">
When this happens, the range will remain unsummarized until the next
regular vacuum run on the table, or one of the functions mentioned above
are invoked.
</span>
この状態が発生すると、テーブルの次の通常バキュームが実行されるか、上で述べた関数のどれかが実行されるまでは、そのレンジはサマライズされない状態にとどまります。
</p><p>
<span class="original">
Conversely, a range can be de-summarized using the
<function>brin_desummarize_range(regclass, bigint)</function> function,
which is useful when the index tuple is no longer a very good
representation because the existing values have changed.
See <xref linkend="functions-admin-index"/> for details.
</span>
反対に、レンジは<code class="function">brin_desummarize_range(regclass, bigint)</code>関数で非サマリー化できます。
これは、既存の値が変更されたためにインデックスタプルがもはや値の表現としては適当でなくなった場合に有効です。
詳細は<a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-INDEX" title="9.27.8. インデックス保守関数">9.27.8</a>を見てください。
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="brin.html" title="第71章 BRINインデックス">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="brin.html" title="第71章 BRINインデックス">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html" title="71.2. 組み込み演算子クラス">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">第71章 BRINインデックス </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.0文書">ホーム</a></td><td width="40%" align="right" valign="top"> 71.2. 組み込み演算子クラス</td></tr></table></div></body></html>