322
322
</tgroup>
323
323
</table>
324
324
325
+ <para>
326
+ BRIN indexes are similar to GiST, SP-GiST and GIN indexes in that they
327
+ don't have a fixed set of strategies either. Instead the support routines
328
+ of each operator class interpret the strategy numbers according to the
329
+ operator class's definition. As an example, the strategy numbers used by
330
+ the built-in <literal>Minmax</> operator classes are shown in
331
+ <xref linkend="xindex-brin-minmax-strat-table">.
332
+ </para>
333
+
334
+ <table tocentry="1" id="xindex-brin-minmax-strat-table">
335
+ <title>BRIN Minmax Strategies</title>
336
+ <tgroup cols="2">
337
+ <thead>
338
+ <row>
339
+ <entry>Operation</entry>
340
+ <entry>Strategy Number</entry>
341
+ </row>
342
+ </thead>
343
+ <tbody>
344
+ <row>
345
+ <entry>less than</entry>
346
+ <entry>1</entry>
347
+ </row>
348
+ <row>
349
+ <entry>less than or equal</entry>
350
+ <entry>2</entry>
351
+ </row>
352
+ <row>
353
+ <entry>equal</entry>
354
+ <entry>3</entry>
355
+ </row>
356
+ <row>
357
+ <entry>greater than or equal</entry>
358
+ <entry>4</entry>
359
+ </row>
360
+ <row>
361
+ <entry>greater than</entry>
362
+ <entry>5</entry>
363
+ </row>
364
+ </tbody>
365
+ </tgroup>
366
+ </table>
367
+
325
368
<para>
326
369
Notice that all the operators listed above return Boolean values. In
327
370
practice, all operators defined as index method search operators must
601
644
</tgroup>
602
645
</table>
603
646
647
+ <para>
648
+ BRIN indexes have four basic support functions, as shown in
649
+ <xref linkend="xindex-brin-support-table">; those basic functions
650
+ may require additional support functions to be provided.
651
+ (For more information see <xref linkend="brin-extensibility">.)
652
+ </para>
653
+
654
+ <table tocentry="1" id="xindex-brin-support-table">
655
+ <title>GIN Support Functions</title>
656
+ <tgroup cols="3">
657
+ <thead>
658
+ <row>
659
+ <entry>Function</entry>
660
+ <entry>Description</entry>
661
+ <entry>Support Number</entry>
662
+ </row>
663
+ </thead>
664
+ <tbody>
665
+ <row>
666
+ <entry><function>opcInfo</></entry>
667
+ <entry>
668
+ return internal information describing the indexed columns'
669
+ summary data
670
+ </entry>
671
+ <entry>1</entry>
672
+ </row>
673
+ <row>
674
+ <entry><function>add_value</></entry>
675
+ <entry>add a new value to an existing summary index tuple</entry>
676
+ <entry>2</entry>
677
+ </row>
678
+ <row>
679
+ <entry><function>consistent</></entry>
680
+ <entry>determine whether value matches query condition</entry>
681
+ <entry>3</entry>
682
+ </row>
683
+ <row>
684
+ <entry><function>union</></entry>
685
+ <entry>
686
+ compute union of two summary tuples
687
+ </entry>
688
+ <entry>4</entry>
689
+ </row>
690
+ </tbody>
691
+ </tgroup>
692
+ </table>
693
+
604
694
<para>
605
695
Unlike search operators, support functions return whichever data
606
696
type the particular index method expects; for example in the case
609
699
dependent on the index method. For B-tree and hash the comparison and
610
700
hashing support functions take the same input data types as do the
611
701
operators included in the operator class, but this is not the case for
612
- most GiST, SP-GiST, and GIN support functions.
702
+ most GiST, SP-GiST, GIN, and BRIN support functions.
613
703
</para>
614
704
</sect2>
615
705
@@ -994,6 +1084,14 @@ ALTER OPERATOR FAMILY integer_ops USING btree ADD
994
1084
handle.
995
1085
</para>
996
1086
1087
+ <para>
1088
+ In BRIN, the requirements depends on the framework that provides the
1089
+ operator classes. For operator classes based on <literal>minmax</>,
1090
+ the behavior required is the same as for B-tree operator families:
1091
+ all the operators in the family must sort compatibly, and casts must
1092
+ not change the associated sort ordering.
1093
+ </para>
1094
+
997
1095
<note>
998
1096
<para>
999
1097
Prior to <productname>PostgreSQL</productname> 8.3, there was no concept
@@ -1178,7 +1276,7 @@ CREATE OPERATOR CLASS polygon_ops
1178
1276
STORAGE box;
1179
1277
</programlisting>
1180
1278
1181
- At present, only the GiST and GIN index methods support a
1279
+ At present, only the GiST, GIN and BRIN index methods support a
1182
1280
<literal>STORAGE</> type that's different from the column data type.
1183
1281
The GiST <function>compress</> and <function>decompress</> support
1184
1282
routines must deal with data-type conversion when <literal>STORAGE</>
@@ -1188,6 +1286,10 @@ CREATE OPERATOR CLASS polygon_ops
1188
1286
integer-array columns might have keys that are just integers. The
1189
1287
GIN <function>extractValue</> and <function>extractQuery</> support
1190
1288
routines are responsible for extracting keys from indexed values.
1289
+ BRIN is similar to GIN: the <literal>STORAGE</> type identifies the
1290
+ type of the stored summary values, and operator classes' support
1291
+ procedures are responsible for interpreting the summary values
1292
+ correctly.
1191
1293
</para>
1192
1294
</sect2>
1193
1295
0 commit comments