|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/gin.sgml,v 2.4 2006/09/18 12:11:36 teodor Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/gin.sgml,v 2.5 2006/11/23 05:58:01 neilc Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="GIN">
|
4 | 4 | <title>GIN Indexes</title>
|
|
31 | 31 | This is much the same advantage as using <acronym>GiST</acronym>.
|
32 | 32 | </para>
|
33 | 33 |
|
34 |
| - <para> |
35 |
| - The <acronym>GIN</acronym> |
36 |
| - implementation in <productname>PostgreSQL</productname> is primarily |
37 |
| - maintained by Teodor Sigaev and Oleg Bartunov, and there is more |
38 |
| - information on their |
39 |
| - <ulink url="http://www.sai.msu.su/~megera/oddmuse/index.cgi/Gin">website</ulink>. |
40 |
| - </para> |
41 |
| - |
| 34 | + <para> |
| 35 | + The <acronym>GIN</acronym> |
| 36 | + implementation in <productname>PostgreSQL</productname> is primarily |
| 37 | + maintained by Teodor Sigaev and Oleg Bartunov. There is more |
| 38 | + information about <acronym>GIN</acronym> on their |
| 39 | + <ulink url="http://www.sai.msu.su/~megera/oddmuse/index.cgi/Gin">website</ulink>. |
| 40 | + </para> |
42 | 41 | </sect1>
|
43 | 42 |
|
44 | 43 | <sect1 id="gin-extensibility">
|
|
78 | 77 |
|
79 | 78 | <variablelist>
|
80 | 79 | <varlistentry>
|
81 |
| - <term>int compare( Datum a, Datum b )</term> |
| 80 | + <term>int compare(Datum a, Datum b)</term> |
82 | 81 | <listitem>
|
83 | 82 | <para>
|
84 | 83 | Compares keys (not indexed values!) and returns an integer less than
|
|
103 | 102 | StrategyNumber n)</term>
|
104 | 103 | <listitem>
|
105 | 104 | <para>
|
106 |
| - Returns an array of keys of the query to be executed. n contains |
107 |
| - the strategy number of the operation |
108 |
| - (see <xref linkend="xindex-strategies">). |
109 |
| - Depending on n, query may be different type. |
| 105 | + Returns an array of keys of the query to be executed. n contains the |
| 106 | + strategy number of the operation (see <xref |
| 107 | + linkend="xindex-strategies">). Depending on n, query may be |
| 108 | + different type. |
110 | 109 | </para>
|
111 | 110 | </listitem>
|
112 | 111 | </varlistentry>
|
113 | 112 |
|
114 | 113 | <varlistentry>
|
115 |
| - <term>bool consistent( bool check[], StrategyNumber n, Datum query)</term> |
| 114 | + <term>bool consistent(bool check[], StrategyNumber n, Datum query)</term> |
116 | 115 | <listitem>
|
117 | 116 | <para>
|
118 | 117 | Returns TRUE if the indexed value satisfies the query qualifier with
|
119 | 118 | strategy n (or may satisfy in case of RECHECK mark in operator class).
|
120 | 119 | Each element of the check array is TRUE if the indexed value has a
|
121 |
| - corresponding key in the query: if (check[i] == TRUE ) the i-th key of |
| 120 | + corresponding key in the query: if (check[i] == TRUE) the i-th key of |
122 | 121 | the query is present in the indexed value.
|
123 | 122 | </para>
|
124 | 123 | </listitem>
|
|
129 | 128 | </sect1>
|
130 | 129 |
|
131 | 130 | <sect1 id="gin-tips">
|
132 |
| -<title>GIN tips and trics</title> |
| 131 | +<title>GIN tips and tricks</title> |
133 | 132 |
|
134 | 133 | <variablelist>
|
135 | 134 | <varlistentry>
|
136 | 135 | <term>Create vs insert</term>
|
137 | 136 | <listitem>
|
138 | 137 | <para>
|
139 |
| - In most cases, insertion into <acronym>GIN</acronym> index is slow |
| 138 | + In most cases, insertion into a <acronym>GIN</acronym> index is slow |
140 | 139 | due to the likelihood of many keys being inserted for each value.
|
141 | 140 | So, for bulk insertions into a table it is advisable to to drop the GIN
|
142 | 141 | index and recreate it after finishing bulk insertion.
|
|
169 | 168 | the whole result set, chosen at random.
|
170 | 169 | </para>
|
171 | 170 | <para>
|
172 |
| - "Soft" means that the actual number of returned results could slightly |
173 |
| - differ from the specified limit, depending on the query and the quality |
174 |
| - of the system's random number generator. |
| 171 | + <quote>Soft</quote> means that the actual number of returned results |
| 172 | + could slightly differ from the specified limit, depending on the query |
| 173 | + and the quality of the system's random number generator. |
175 | 174 | </para>
|
176 | 175 | </listitem>
|
177 | 176 | </varlistentry>
|
|
184 | 183 |
|
185 | 184 | <para>
|
186 | 185 | <acronym>GIN</acronym> doesn't support full index scans due to their
|
187 |
| - extremely inefficiency: because there are often many keys per value, |
| 186 | + extreme inefficiency: because there are often many keys per value, |
188 | 187 | each heap pointer will returned several times.
|
189 | 188 | </para>
|
190 | 189 |
|
191 | 190 | <para>
|
192 |
| - When extractQuery returns zero keys, <acronym>GIN</acronym> will emit a |
193 |
| - error: for different opclasses and strategies the semantic meaning of a void |
194 |
| - query may be different (for example, any array contains the void array, |
195 |
| - but they don't overlap the void array), and <acronym>GIN</acronym> can't |
196 |
| - suggest reasonable answer. |
| 191 | + When <function>extractQuery</function> returns zero keys, |
| 192 | + <acronym>GIN</acronym> will emit an error: for different opclasses and |
| 193 | + strategies the semantic meaning of a void query may be different (for |
| 194 | + example, any array contains the void array, but they don't overlap the |
| 195 | + void array), and <acronym>GIN</acronym> can't suggest a reasonable answer. |
197 | 196 | </para>
|
198 | 197 |
|
199 | 198 | <para>
|
|
0 commit comments