-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtree-gist.html
More file actions
138 lines (137 loc) · 14.5 KB
/
btree-gist.html
File metadata and controls
138 lines (137 loc) · 14.5 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
<?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>F.8. btree_gist — GiST演算子クラスとB-tree動作</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="btree-gin.html" title="F.7. btree_gin — GIN演算子クラスとB-tree動作" /><link rel="next" href="citext.html" title="F.9. citext — 大文字小文字の区別がない文字列型" /><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 18.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="contrib.html" title="付録F 追加で提供されるモジュールと拡張">付録F 追加で提供されるモジュールと拡張</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 18.3 : btree-gist.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="btree-gin.html" title="F.7. btree_gin — GIN演算子クラスとB-tree動作">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="付録F 追加で提供されるモジュールと拡張">上へ</a></td><td width="60%" align="center">F.8. btree_gist — GiST演算子クラスとB-tree動作</td><td width="20%" align="right"> <a accesskey="n" href="citext.html" title="F.9. citext — 大文字小文字の区別がない文字列型">次へ</a></td></tr></table><hr /></div><div class="sect1" id="BTREE-GIST"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.8. btree_gist — GiST演算子クラスとB-tree動作 <a href="#BTREE-GIST" class="id_link">#</a></h2></div></div></div><span class="original">
<title>btree_gist &mdash; GiST operator classes with B-tree behavior</title>
</span><a id="id-1.11.7.18.2" class="indexterm"></a><p>
<span class="original">
<filename>btree_gist</filename> provides GiST index operator classes that
implement B-tree equivalent behavior for the data types
<type>int2</type>, <type>int4</type>, <type>int8</type>, <type>float4</type>,
<type>float8</type>, <type>numeric</type>, <type>timestamp with time zone</type>,
<type>timestamp without time zone</type>, <type>time with time zone</type>,
<type>time without time zone</type>, <type>date</type>, <type>interval</type>,
<type>oid</type>, <type>money</type>, <type>char</type>,
<type>varchar</type>, <type>text</type>, <type>bytea</type>, <type>bit</type>,
<type>varbit</type>, <type>macaddr</type>, <type>macaddr8</type>, <type>inet</type>,
<type>cidr</type>, <type>uuid</type>, <type>bool</type> and all <type>enum</type> types.
</span>
<code class="filename">btree_gist</code>は、次に列挙するデータ型に対しB-treeと同等な動作を実装するGiSTインデックス演算子クラスを提供します。データ型は、<code class="type">int2</code>、<code class="type">int4</code>、<code class="type">int8</code>、<code class="type">float4</code>、<code class="type">float8</code>、<code class="type">numeric</code>、<code class="type">timestamp with time zone</code>、<code class="type">timestamp without time zone</code>、<code class="type">time with time zone</code>、<code class="type">time without time zone</code>、<code class="type">date</code>、<code class="type">interval</code>、<code class="type">oid</code>、<code class="type">money</code>、<code class="type">char</code>、<code class="type">varchar</code>、<code class="type">text</code>、<code class="type">bytea</code>、 <code class="type">bit</code>、<code class="type">varbit</code>、<code class="type">macaddr</code>、<code class="type">macaddr8</code>、<code class="type">inet</code>、<code class="type">cidr</code>、<code class="type">uuid</code>、<code class="type">bool</code>、およびすべての<code class="type">enum</code>型です。
</p><p>
<span class="original">
In general, these operator classes will not outperform the equivalent
standard B-tree index methods, and they lack one major feature of the
standard B-tree code: the ability to enforce uniqueness. However,
they provide some other features that are not available with a B-tree
index, as described below. Also, these operator classes are useful
when a multicolumn GiST index is needed, wherein some of the columns
are of data types that are only indexable with GiST but other columns
are just simple data types. Lastly, these operator classes are useful for
GiST testing and as a base for developing other GiST operator classes.
</span>
一般的に、これらの演算子クラスは同等な標準B-treeインデックスメソッドを性能的に凌駕する物ではなく、標準B-treeコードの1つの重要機能である一意性を強制する能力を欠いています。
しかしながら、以下で述べるようにB-treeインデックスにはない特徴をいくつか備えています。
また、これらの演算子クラスは、GiSTでのみインデックス可能なデータ型の列もあれば、単純なデータ型の列もあるような複数列のGiSTインデックスが必要な場合に便利です。
最後に、GiSTの試験、およびその他のGiST演算子クラスの開発の基礎として便利です。
</p><p>
<span class="original">
In addition to the typical B-tree search operators, <filename>btree_gist</filename>
also provides index support for <literal>&lt;&gt;</literal> (<quote>not
equals</quote>). This may be useful in combination with an
<link linkend="sql-createtable-exclude">exclusion constraint</link>,
as described below.
</span>
典型的なB-tree検索演算子に加えて、<code class="filename">btree_gist</code>は<code class="literal"><></code>(<span class="quote">「<span class="quote">等しくない</span>」</span>)に対してもインデックスのサポートを提供します。
これは、後で述べるような<a class="link" href="sql-createtable.html#SQL-CREATETABLE-EXCLUDE">排他制約</a>と組み合わせると便利でしょう。
</p><p>
<span class="original">
Also, for data types for which there is a natural distance metric,
<filename>btree_gist</filename> defines a distance operator <literal>&lt;-&gt;</literal>,
and provides GiST index support for nearest-neighbor searches using
this operator. Distance operators are provided for
<type>int2</type>, <type>int4</type>, <type>int8</type>, <type>float4</type>,
<type>float8</type>, <type>timestamp with time zone</type>,
<type>timestamp without time zone</type>,
<type>time without time zone</type>, <type>date</type>, <type>interval</type>,
<type>oid</type>, and <type>money</type>.
</span>
また、自然な距離のあるデータ型には、<code class="filename">btree_gist</code>は距離演算子<code class="literal"><-></code>を定義し、この演算子を使った最近接検索へのGiSTインデックスのサポートを提供します。
距離演算子は<code class="type">int2</code>、<code class="type">int4</code>、<code class="type">int8</code>、<code class="type">float4</code>、<code class="type">float8</code>、<code class="type">timestamp with time zone</code>、<code class="type">timestamp without time zone</code>、<code class="type">time without time zone</code>、<code class="type">date</code>、<code class="type">interval</code>、<code class="type">oid</code>、<code class="type">money</code>に提供されます。
</p><p>
<span class="original">
By default <filename>btree_gist</filename> builds <acronym>GiST</acronym> index with
<function>sortsupport</function> in <firstterm>sorted</firstterm> mode. This usually results in
much faster index built speed. It is still possible to revert to buffered built strategy
by using the <literal>buffering</literal> parameter when creating the index.
</span>
デフォルトでは、<code class="filename">btree_gist</code>は<code class="function">sortsupport</code>による<em class="firstterm">ソート処理</em>モードで<acronym class="acronym">GiST</acronym>インデックスを構築します。
これにより、通常、インデックスの構築速度が大幅に向上します。
インデックスの作成時に<code class="literal">buffering</code>パラメータを使用することで、バッファ処理での構築戦略に変更することもできます。
</p><p>
<span class="original">
This module is considered <quote>trusted</quote>, that is, it can be
installed by non-superusers who have <literal>CREATE</literal> privilege
on the current database.
</span>
このモジュールは<span class="quote">「<span class="quote">trusted</span>」</span>と見なされます。つまり、現在のデータベースに対して<code class="literal">CREATE</code>権限を持つ非スーパーユーザがインストールできます。
</p><div class="sect2" id="BTREE-GIST-EXAMPLE-USAGE"><div class="titlepage"><div><div><h3 class="title">F.8.1. 使用例 <a href="#BTREE-GIST-EXAMPLE-USAGE" class="id_link">#</a></h3></div></div></div><span class="original">
<title>Example Usage</title>
</span><p>
<span class="original">
Simple example using <literal>btree_gist</literal> instead of <literal>btree</literal>:
</span>
<code class="literal">btree</code>の代わりに<code class="literal">btree_gist</code>を使った簡単な例
</p><pre class="programlisting">
CREATE TABLE test (a int4);
<span class="original">
&#45;- create index
</span>
-- インデックスの作成
CREATE INDEX testidx ON test USING GIST (a);
<span class="original">
&#45;- query
</span>
-- 問い合わせ
SELECT * FROM test WHERE a < 10;
<span class="original">
&#45;- nearest-neighbor search: find the ten entries closest to "42"
</span>
-- 最近接検索: "42"に一番近い10個のエントリを見つける
SELECT *, a <-> 42 AS dist FROM test ORDER BY a <-> 42 LIMIT 10;
</pre><p>
<span class="original">
Use an <link linkend="sql-createtable-exclude">exclusion
constraint</link> to enforce the rule that a cage at a zoo
can contain only one kind of animal:
</span>
動物園の一つの檻に1種類の動物しかいないというルールを強制するために<a class="link" href="sql-createtable.html#SQL-CREATETABLE-EXCLUDE">排他制約</a>を使います。
</p><pre class="programlisting">
=> CREATE TABLE zoo (
cage INTEGER,
animal TEXT,
EXCLUDE USING GIST (cage WITH =, animal WITH <>)
);
=> INSERT INTO zoo VALUES(123, 'zebra');
INSERT 0 1
=> INSERT INTO zoo VALUES(123, 'zebra');
INSERT 0 1
=> INSERT INTO zoo VALUES(123, 'lion');
ERROR: conflicting key value violates exclusion constraint "zoo_cage_animal_excl"
DETAIL: Key (cage, animal)=(123, lion) conflicts with existing key (cage, animal)=(123, zebra).
=> INSERT INTO zoo VALUES(124, 'lion');
INSERT 0 1
</pre></div><div class="sect2" id="BTREE-GIST-AUTHORS"><div class="titlepage"><div><div><h3 class="title">F.8.2. 作者 <a href="#BTREE-GIST-AUTHORS" class="id_link">#</a></h3></div></div></div><span class="original">
<title>Authors</title>
</span><p>
<span class="original">
Teodor Sigaev (<email>teodor@stack.net</email>),
Oleg Bartunov (<email>oleg@sai.msu.su</email>),
Janko Richter (<email>jankorichter@yahoo.de</email>), and
Paul Jungwirth (<email>pj@illuminatedcomputing.com</email>). See
<ulink url="http://www.sai.msu.su/~megera/postgres/gist/"></ulink>
for additional information.
</span>
Teodor Sigaev(<code class="email"><<a class="email" href="mailto:teodor@stack.net">teodor@stack.net</a>></code>)、
Oleg Bartunov(<code class="email"><<a class="email" href="mailto:oleg@sai.msu.su">oleg@sai.msu.su</a>></code>)、
Janko Richter (<code class="email"><<a class="email" href="mailto:jankorichter@yahoo.de">jankorichter@yahoo.de</a>></code>)、およびPaul Jungwirth (<code class="email"><<a class="email" href="mailto:pj@illuminatedcomputing.com">pj@illuminatedcomputing.com</a>></code>)。
追加情報は<a class="ulink" href="http://www.sai.msu.su/~megera/postgres/gist/" target="_top">http://www.sai.msu.su/~megera/postgres/gist/</a>を参照ください。
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="btree-gin.html" title="F.7. btree_gin — GIN演算子クラスとB-tree動作">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="付録F 追加で提供されるモジュールと拡張">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="citext.html" title="F.9. citext — 大文字小文字の区別がない文字列型">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">F.7. btree_gin — GIN演算子クラスとB-tree動作 </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> F.9. citext — 大文字小文字の区別がない文字列型</td></tr></table></div></body></html>