-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrin-intro.html
More file actions
81 lines (81 loc) · 10.4 KB
/
Copy pathbrin-intro.html
File metadata and controls
81 lines (81 loc) · 10.4 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
<?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>62.1. はじめに</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="brin.html" title="第62章 BRINインデックス" /><link rel="prev" href="brin.html" title="第62章 BRINインデックス" /><link rel="next" href="brin-builtin-opclasses.html" title="62.2. 組込み演算子クラス" /><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 brin-intro.html">誤訳等の報告</a></div></td></tr><tr><td width="10%" align="left" valign="top"><a accesskey="p" href="brin.html">前へ</a> </td><td width="10%" align="left" valign="top"><a accesskey="u" href="brin.html">上へ</a></td><td width="60%" align="center">62.1. はじめに</td><td width="20%" align="right" valign="top"> <a accesskey="n" href="brin-builtin-opclasses.html">次へ</a></td></tr></table><hr /></div><div class="sect1" id="brin-intro"><div class="titlepage"><div><div><h2 class="title" style="clear: both">62.1. はじめに</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.
A <firstterm>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>は「ブロックレンジインデックス」(Block Range Index)の略です。
<acronym class="acronym">BRIN</acronym>は、ある列がテーブル内の物理的な位置と自然な関係があるような、非常に大規模なテーブルのために設計されています。
<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</> 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>インデックスは、通常のビットマップインデックススキャンを通じて要求されるクエリに使用することができます。
すなわち、インデックス内のレンジ要約情報が検索条件と一致すれば、<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</> 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</>. 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">62.1.1. インデックスの保守</h3></div></div></div><span class="original">
<title>Index Maintenance</title>
</span><p><span class="original">
At the time of creation, all existing index 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, that range does not automatically acquire a summary
tuple; those tuples remain unsummarized until a summarization run is
invoked later, creating initial summaries.
This process can be invoked manually using the
<function>brin_summarize_new_values(regclass)</function> function,
or automatically when <command>VACUUM</command> processes the table.
</span>インデックスを作成した当初は、すべてのインデックスページがスキャンされ、終端が不完全なものも含め、各々のレンジに対してサマリーインデックスタプルが作成されます。
新しいページにデータが登録されると、新しいタプルのデータを元に、すでにサマリ済みのページレンジのサマリー情報が更新されます。
最終サマリーレンジに適合しない新しいページが作成されると、そのレンジに対して自動的にはサマリタプルが作成されません。
これらのタプルは、後でサマリー処理が走って初期サマリー情報が作成されるまではサマリーされません。
この処理は、手動で<code class="function">brin_summarize_new_values(regclass)</code>関数を起動するか、<code class="command">VACUUM</code>がそのテーブルを処理する際に自動的に行われます。
</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">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="brin.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">第62章 BRINインデックス </td><td width="20%" align="center"><a accesskey="h" href="index.html">ホーム</a></td><td width="40%" align="right" valign="top"> 62.2. 組込み演算子クラス</td></tr></table></div></body></html>