|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/gin.sgml,v 2.17 2009/03/24 20:17:07 tgl Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/gin.sgml,v 2.18 2009/03/25 22:19:01 tgl Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="GIN">
|
4 | 4 | <title>GIN Indexes</title>
|
|
88 | 88 |
|
89 | 89 | <varlistentry>
|
90 | 90 | <term>Datum *extractQuery(Datum query, int32 *nkeys,
|
91 |
| - StrategyNumber n, bool **pmatch)</term> |
| 91 | + StrategyNumber n, bool **pmatch, Pointer **extra_data)</term> |
92 | 92 | <listitem>
|
93 | 93 | <para>
|
94 | 94 | Returns an array of keys given a value to be queried; that is,
|
|
104 | 104 | should store 0 or -1 into <literal>*nkeys</>, depending on the
|
105 | 105 | semantics of the operator. 0 means that every
|
106 | 106 | value matches the <literal>query</> and a sequential scan should be
|
107 |
| - produced. -1 means nothing can match the <literal>query</>. |
| 107 | + performed. -1 means nothing can match the <literal>query</>. |
108 | 108 | <literal>pmatch</> is an output argument for use when partial match
|
109 | 109 | is supported. To use it, <function>extractQuery</> must allocate
|
110 | 110 | an array of <literal>*nkeys</> booleans and store its address at
|
|
114 | 114 | is not required. The variable is initialized to NULL before call,
|
115 | 115 | so this argument can simply be ignored by operator classes that do
|
116 | 116 | not support partial match.
|
| 117 | + <literal>extra_data</> is an output argument that allows |
| 118 | + <function>extractQuery</> to pass additional data to the |
| 119 | + <function>consistent</> and <function>comparePartial</> methods. |
| 120 | + To use it, <function>extractQuery</> must allocate |
| 121 | + an array of <literal>*nkeys</> Pointers and store its address at |
| 122 | + <literal>*extra_data</>, then store whatever it wants to into the |
| 123 | + individual pointers. The variable is initialized to NULL before |
| 124 | + call, so this argument can simply be ignored by operator classes that |
| 125 | + do not require extra data. If <literal>*extra_data</> is set, the |
| 126 | + whole array is passed to the <function>consistent</> method, and |
| 127 | + the appropriate element to the <function>comparePartial</> method. |
117 | 128 | </para>
|
118 | 129 |
|
119 | 130 | </listitem>
|
120 | 131 | </varlistentry>
|
121 | 132 |
|
122 | 133 | <varlistentry>
|
123 |
| - <term>bool consistent(bool check[], StrategyNumber n, Datum query, bool *recheck)</term> |
| 134 | + <term>bool consistent(bool check[], StrategyNumber n, Datum query, |
| 135 | + int32 nkeys, Pointer extra_data[], bool *recheck)</term> |
124 | 136 | <listitem>
|
125 | 137 | <para>
|
126 | 138 | Returns TRUE if the indexed value satisfies the query operator with
|
127 | 139 | strategy number <literal>n</> (or might satisfy, if the recheck
|
128 |
| - indication is returned). The <literal>check</> array has |
129 |
| - the same length as the number of keys previously returned by |
130 |
| - <function>extractQuery</> for this query. Each element of the |
| 140 | + indication is returned). The <literal>check</> array has length |
| 141 | + <literal>nkeys</>, which is the same as the number of keys previously |
| 142 | + returned by <function>extractQuery</> for this <literal>query</> datum. |
| 143 | + Each element of the |
131 | 144 | <literal>check</> array is TRUE if the indexed value contains the
|
132 | 145 | corresponding query key, ie, if (check[i] == TRUE) the i-th key of the
|
133 | 146 | <function>extractQuery</> result array is present in the indexed value.
|
134 | 147 | The original <literal>query</> datum (not the extracted key array!) is
|
135 | 148 | passed in case the <function>consistent</> method needs to consult it.
|
| 149 | + <literal>extra_data</> is the extra-data array returned by |
| 150 | + <function>extractQuery</>, or NULL if none. |
136 | 151 | On success, <literal>*recheck</> should be set to TRUE if the heap
|
137 | 152 | tuple needs to be rechecked against the query operator, or FALSE if
|
138 | 153 | the index test is exact.
|
|
150 | 165 | <variablelist>
|
151 | 166 |
|
152 | 167 | <varlistentry>
|
153 |
| - <term>int comparePartial(Datum partial_key, Datum key, StrategyNumber n)</term> |
| 168 | + <term>int comparePartial(Datum partial_key, Datum key, StrategyNumber n, |
| 169 | + Pointer extra_data)</term> |
154 | 170 | <listitem>
|
155 | 171 | <para>
|
156 | 172 | Compare a partial-match query to an index key. Returns an integer
|
|
160 | 176 | indicates that the index scan should stop because no more matches
|
161 | 177 | are possible. The strategy number <literal>n</> of the operator
|
162 | 178 | that generated the partial match query is provided, in case its
|
163 |
| - semantics are needed to determine when to end the scan. |
| 179 | + semantics are needed to determine when to end the scan. Also, |
| 180 | + <literal>extra_data</> is the corresponding element of the extra-data |
| 181 | + array made by <function>extractQuery</>, or NULL if none. |
164 | 182 | </para>
|
165 | 183 | </listitem>
|
166 | 184 | </varlistentry>
|
|
383 | 401 | </para>
|
384 | 402 |
|
385 | 403 | <variablelist>
|
| 404 | + <varlistentry> |
| 405 | + <term>btree-gin</term> |
| 406 | + <listitem> |
| 407 | + <para>B-Tree equivalent functionality for several data types</para> |
| 408 | + </listitem> |
| 409 | + </varlistentry> |
| 410 | + |
386 | 411 | <varlistentry>
|
387 | 412 | <term>hstore</term>
|
388 | 413 | <listitem>
|
|
0 commit comments