1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!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>65.5. BRIN Indexes</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="gin.html" title="65.4. GIN Indexes" /><link rel="next" href="hash-index.html" title="65.6. Hash Indexes" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">65.5. BRIN Indexes</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="gin.html" title="65.4. GIN Indexes">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="indextypes.html" title="Chapter 65. Built-in Index Access Methods">Up</a></td><th width="60%" align="center">Chapter 65. Built-in Index Access Methods</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="hash-index.html" title="65.6. Hash Indexes">Next</a></td></tr></table><hr /></div><div class="sect1" id="BRIN"><div class="titlepage"><div><div><h2 class="title" style="clear: both">65.5. BRIN Indexes <a href="#BRIN" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="brin.html#BRIN-INTRO">65.5.1. Introduction</a></span></dt><dt><span class="sect2"><a href="brin.html#BRIN-BUILTIN-OPCLASSES">65.5.2. Built-in Operator Classes</a></span></dt><dt><span class="sect2"><a href="brin.html#BRIN-EXTENSIBILITY">65.5.3. Extensibility</a></span></dt></dl></div><a id="id-1.10.17.6.2" class="indexterm"></a><div class="sect2" id="BRIN-INTRO"><div class="titlepage"><div><div><h3 class="title">65.5.1. Introduction <a href="#BRIN-INTRO" class="id_link">#</a></h3></div></div></div><p>
3 <acronym class="acronym">BRIN</acronym> stands for Block Range Index.
4 <acronym class="acronym">BRIN</acronym> is designed for handling very large tables
5 in which certain columns have some natural correlation with their
6 physical location within the table.
8 <acronym class="acronym">BRIN</acronym> works in terms of <em class="firstterm">block ranges</em>
9 (or <span class="quote">“<span class="quote">page ranges</span>”</span>).
10 A block range is a group of pages that are physically
11 adjacent in the table; for each block range, some summary info is stored
13 For example, a table storing a store's sale orders might have
14 a date column on which each order was placed, and most of the time
15 the entries for earlier orders will appear earlier in the table as well;
16 a table storing a ZIP code column might have all codes for a city
17 grouped together naturally.
19 <acronym class="acronym">BRIN</acronym> indexes can satisfy queries via regular bitmap
20 index scans, and will return all tuples in all pages within each range if
21 the summary info stored by the index is <em class="firstterm">consistent</em> with the
23 The query executor is in charge of rechecking these tuples and discarding
24 those that do not match the query conditions — in other words, these
26 Because a <acronym class="acronym">BRIN</acronym> index is very small, scanning the index
27 adds little overhead compared to a sequential scan, but may avoid scanning
28 large parts of the table that are known not to contain matching tuples.
30 The specific data that a <acronym class="acronym">BRIN</acronym> index will store,
31 as well as the specific queries that the index will be able to satisfy,
32 depend on the operator class selected for each column of the index.
33 Data types having a linear sort order can have operator classes that
34 store the minimum and maximum value within each block range, for instance;
35 geometrical types might store the bounding box for all the objects
38 The size of the block range is determined at index creation time by
39 the <code class="literal">pages_per_range</code> storage parameter. The number of index
40 entries will be equal to the size of the relation in pages divided by
41 the selected value for <code class="literal">pages_per_range</code>. Therefore, the smaller
42 the number, the larger the index becomes (because of the need to
43 store more index entries), but at the same time the summary data stored can
44 be more precise and more data blocks can be skipped during an index scan.
45 </p><div class="sect3" id="BRIN-OPERATION"><div class="titlepage"><div><div><h4 class="title">65.5.1.1. Index Maintenance <a href="#BRIN-OPERATION" class="id_link">#</a></h4></div></div></div><p>
46 At the time of creation, all existing heap pages are scanned and a
47 summary index tuple is created for each range, including the
48 possibly-incomplete range at the end.
49 As new pages are filled with data, page ranges that are already
50 summarized will cause the summary information to be updated with data
52 When a new page is created that does not fall within the last
53 summarized range, the range that the new page belongs to
54 does not automatically acquire a summary tuple;
55 those tuples remain unsummarized until a summarization run is
56 invoked later, creating the initial summary for that range.
58 There are several ways to trigger the initial summarization of a page range.
59 If the table is vacuumed, either manually or by
60 <a class="link" href="routine-vacuuming.html#AUTOVACUUM" title="24.1.6. The Autovacuum Daemon">autovacuum</a>, all existing unsummarized
61 page ranges are summarized.
63 <a class="xref" href="sql-createindex.html#INDEX-RELOPTION-AUTOSUMMARIZE">autosummarize</a> parameter is enabled,
64 which it isn't by default,
65 whenever autovacuum runs in that database, summarization will occur for all
66 unsummarized page ranges that have been filled,
67 regardless of whether the table itself is processed by autovacuum; see below.
69 Lastly, the following functions can be used (while these functions run,
70 <a class="xref" href="runtime-config-client.html#GUC-SEARCH-PATH">search_path</a> is temporarily changed to
71 <code class="literal">pg_catalog, pg_temp</code>):
72 </p><table border="0" summary="Simple list" class="simplelist"><tr><td>
73 <code class="function">brin_summarize_new_values(regclass)</code>
74 which summarizes all unsummarized ranges;
76 <code class="function">brin_summarize_range(regclass, bigint)</code>
77 which summarizes only the range containing the given page,
78 if it is unsummarized.
81 When autosummarization is enabled, a request is sent to
82 <code class="literal">autovacuum</code> to execute a targeted summarization
83 for a block range when an insertion is detected for the first item
84 of the first page of the next block range,
85 to be fulfilled the next time an autovacuum
86 worker finishes running in the
87 same database. If the request queue is full, the request is not recorded
88 and a message is sent to the server log:
89 </p><pre class="screen">
90 LOG: request for BRIN range summarization for index "brin_wi_idx" page 128 was not recorded
92 When this happens, the range will remain unsummarized until the next
93 regular vacuum run on the table, or one of the functions mentioned above
96 Conversely, a range can be de-summarized using the
97 <code class="function">brin_desummarize_range(regclass, bigint)</code> function,
98 which is useful when the index tuple is no longer a very good
99 representation because the existing values have changed.
100 See <a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-INDEX" title="9.28.8. Index Maintenance Functions">Section 9.28.8</a> for details.
101 </p></div></div><div class="sect2" id="BRIN-BUILTIN-OPCLASSES"><div class="titlepage"><div><div><h3 class="title">65.5.2. Built-in Operator Classes <a href="#BRIN-BUILTIN-OPCLASSES" class="id_link">#</a></h3></div></div></div><p>
102 The core <span class="productname">PostgreSQL</span> distribution
103 includes the <acronym class="acronym">BRIN</acronym> operator classes shown in
104 <a class="xref" href="brin.html#BRIN-BUILTIN-OPCLASSES-TABLE" title="Table 65.4. Built-in BRIN Operator Classes">Table 65.4</a>.
106 The <em class="firstterm">minmax</em>
107 operator classes store the minimum and the maximum values appearing
108 in the indexed column within the range. The <em class="firstterm">inclusion</em>
109 operator classes store a value which includes the values in the indexed
110 column within the range. The <em class="firstterm">bloom</em> operator
111 classes build a Bloom filter for all values in the range. The
112 <em class="firstterm">minmax-multi</em> operator classes store multiple
113 minimum and maximum values, representing values appearing in the indexed
114 column within the range.
115 </p><div class="table" id="BRIN-BUILTIN-OPCLASSES-TABLE"><p class="title"><strong>Table 65.4. Built-in <acronym class="acronym">BRIN</acronym> Operator Classes</strong></p><div class="table-contents"><table class="table" summary="Built-in BRIN Operator Classes" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Name</th><th>Indexable Operators</th></tr></thead><tbody><tr><td rowspan="5" valign="middle"><code class="literal">bit_minmax_ops</code></td><td><code class="literal">= (bit,bit)</code></td></tr><tr><td><code class="literal">< (bit,bit)</code></td></tr><tr><td><code class="literal">> (bit,bit)</code></td></tr><tr><td><code class="literal"><= (bit,bit)</code></td></tr><tr><td><code class="literal">>= (bit,bit)</code></td></tr><tr><td rowspan="13" valign="middle"><code class="literal">box_inclusion_ops</code></td><td><code class="literal">@> (box,point)</code></td></tr><tr><td><code class="literal"><< (box,box)</code></td></tr><tr><td><code class="literal">&< (box,box)</code></td></tr><tr><td><code class="literal">&> (box,box)</code></td></tr><tr><td><code class="literal">>> (box,box)</code></td></tr><tr><td><code class="literal"><@ (box,box)</code></td></tr><tr><td><code class="literal">@> (box,box)</code></td></tr><tr><td><code class="literal">~= (box,box)</code></td></tr><tr><td><code class="literal">&& (box,box)</code></td></tr><tr><td><code class="literal"><<| (box,box)</code></td></tr><tr><td><code class="literal">&<| (box,box)</code></td></tr><tr><td><code class="literal">|&> (box,box)</code></td></tr><tr><td><code class="literal">|>> (box,box)</code></td></tr><tr><td valign="middle"><code class="literal">bpchar_bloom_ops</code></td><td><code class="literal">= (character,character)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">bpchar_minmax_ops</code></td><td><code class="literal">= (character,character)</code></td></tr><tr><td><code class="literal">< (character,character)</code></td></tr><tr><td><code class="literal"><= (character,character)</code></td></tr><tr><td><code class="literal">> (character,character)</code></td></tr><tr><td><code class="literal">>= (character,character)</code></td></tr><tr><td valign="middle"><code class="literal">bytea_bloom_ops</code></td><td><code class="literal">= (bytea,bytea)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">bytea_minmax_ops</code></td><td><code class="literal">= (bytea,bytea)</code></td></tr><tr><td><code class="literal">< (bytea,bytea)</code></td></tr><tr><td><code class="literal"><= (bytea,bytea)</code></td></tr><tr><td><code class="literal">> (bytea,bytea)</code></td></tr><tr><td><code class="literal">>= (bytea,bytea)</code></td></tr><tr><td valign="middle"><code class="literal">char_bloom_ops</code></td><td><code class="literal">= ("char","char")</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">char_minmax_ops</code></td><td><code class="literal">= ("char","char")</code></td></tr><tr><td><code class="literal">< ("char","char")</code></td></tr><tr><td><code class="literal"><= ("char","char")</code></td></tr><tr><td><code class="literal">> ("char","char")</code></td></tr><tr><td><code class="literal">>= ("char","char")</code></td></tr><tr><td valign="middle"><code class="literal">date_bloom_ops</code></td><td><code class="literal">= (date,date)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">date_minmax_ops</code></td><td><code class="literal">= (date,date)</code></td></tr><tr><td><code class="literal">< (date,date)</code></td></tr><tr><td><code class="literal"><= (date,date)</code></td></tr><tr><td><code class="literal">> (date,date)</code></td></tr><tr><td><code class="literal">>= (date,date)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">date_minmax_multi_ops</code></td><td><code class="literal">= (date,date)</code></td></tr><tr><td><code class="literal">< (date,date)</code></td></tr><tr><td><code class="literal"><= (date,date)</code></td></tr><tr><td><code class="literal">> (date,date)</code></td></tr><tr><td><code class="literal">>= (date,date)</code></td></tr><tr><td valign="middle"><code class="literal">float4_bloom_ops</code></td><td><code class="literal">= (float4,float4)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">float4_minmax_ops</code></td><td><code class="literal">= (float4,float4)</code></td></tr><tr><td><code class="literal">< (float4,float4)</code></td></tr><tr><td><code class="literal">> (float4,float4)</code></td></tr><tr><td><code class="literal"><= (float4,float4)</code></td></tr><tr><td><code class="literal">>= (float4,float4)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">float4_minmax_multi_ops</code></td><td><code class="literal">= (float4,float4)</code></td></tr><tr><td><code class="literal">< (float4,float4)</code></td></tr><tr><td><code class="literal">> (float4,float4)</code></td></tr><tr><td><code class="literal"><= (float4,float4)</code></td></tr><tr><td><code class="literal">>= (float4,float4)</code></td></tr><tr><td valign="middle"><code class="literal">float8_bloom_ops</code></td><td><code class="literal">= (float8,float8)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">float8_minmax_ops</code></td><td><code class="literal">= (float8,float8)</code></td></tr><tr><td><code class="literal">< (float8,float8)</code></td></tr><tr><td><code class="literal"><= (float8,float8)</code></td></tr><tr><td><code class="literal">> (float8,float8)</code></td></tr><tr><td><code class="literal">>= (float8,float8)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">float8_minmax_multi_ops</code></td><td><code class="literal">= (float8,float8)</code></td></tr><tr><td><code class="literal">< (float8,float8)</code></td></tr><tr><td><code class="literal"><= (float8,float8)</code></td></tr><tr><td><code class="literal">> (float8,float8)</code></td></tr><tr><td><code class="literal">>= (float8,float8)</code></td></tr><tr><td rowspan="6" valign="middle"><code class="literal">inet_inclusion_ops</code></td><td><code class="literal"><< (inet,inet)</code></td></tr><tr><td><code class="literal"><<= (inet,inet)</code></td></tr><tr><td><code class="literal">>> (inet,inet)</code></td></tr><tr><td><code class="literal">>>= (inet,inet)</code></td></tr><tr><td><code class="literal">= (inet,inet)</code></td></tr><tr><td><code class="literal">&& (inet,inet)</code></td></tr><tr><td valign="middle"><code class="literal">inet_bloom_ops</code></td><td><code class="literal">= (inet,inet)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">inet_minmax_ops</code></td><td><code class="literal">= (inet,inet)</code></td></tr><tr><td><code class="literal">< (inet,inet)</code></td></tr><tr><td><code class="literal"><= (inet,inet)</code></td></tr><tr><td><code class="literal">> (inet,inet)</code></td></tr><tr><td><code class="literal">>= (inet,inet)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">inet_minmax_multi_ops</code></td><td><code class="literal">= (inet,inet)</code></td></tr><tr><td><code class="literal">< (inet,inet)</code></td></tr><tr><td><code class="literal"><= (inet,inet)</code></td></tr><tr><td><code class="literal">> (inet,inet)</code></td></tr><tr><td><code class="literal">>= (inet,inet)</code></td></tr><tr><td valign="middle"><code class="literal">int2_bloom_ops</code></td><td><code class="literal">= (int2,int2)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">int2_minmax_ops</code></td><td><code class="literal">= (int2,int2)</code></td></tr><tr><td><code class="literal">< (int2,int2)</code></td></tr><tr><td><code class="literal">> (int2,int2)</code></td></tr><tr><td><code class="literal"><= (int2,int2)</code></td></tr><tr><td><code class="literal">>= (int2,int2)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">int2_minmax_multi_ops</code></td><td><code class="literal">= (int2,int2)</code></td></tr><tr><td><code class="literal">< (int2,int2)</code></td></tr><tr><td><code class="literal">> (int2,int2)</code></td></tr><tr><td><code class="literal"><= (int2,int2)</code></td></tr><tr><td><code class="literal">>= (int2,int2)</code></td></tr><tr><td valign="middle"><code class="literal">int4_bloom_ops</code></td><td><code class="literal">= (int4,int4)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">int4_minmax_ops</code></td><td><code class="literal">= (int4,int4)</code></td></tr><tr><td><code class="literal">< (int4,int4)</code></td></tr><tr><td><code class="literal">> (int4,int4)</code></td></tr><tr><td><code class="literal"><= (int4,int4)</code></td></tr><tr><td><code class="literal">>= (int4,int4)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">int4_minmax_multi_ops</code></td><td><code class="literal">= (int4,int4)</code></td></tr><tr><td><code class="literal">< (int4,int4)</code></td></tr><tr><td><code class="literal">> (int4,int4)</code></td></tr><tr><td><code class="literal"><= (int4,int4)</code></td></tr><tr><td><code class="literal">>= (int4,int4)</code></td></tr><tr><td valign="middle"><code class="literal">int8_bloom_ops</code></td><td><code class="literal">= (bigint,bigint)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">int8_minmax_ops</code></td><td><code class="literal">= (bigint,bigint)</code></td></tr><tr><td><code class="literal">< (bigint,bigint)</code></td></tr><tr><td><code class="literal">> (bigint,bigint)</code></td></tr><tr><td><code class="literal"><= (bigint,bigint)</code></td></tr><tr><td><code class="literal">>= (bigint,bigint)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">int8_minmax_multi_ops</code></td><td><code class="literal">= (bigint,bigint)</code></td></tr><tr><td><code class="literal">< (bigint,bigint)</code></td></tr><tr><td><code class="literal">> (bigint,bigint)</code></td></tr><tr><td><code class="literal"><= (bigint,bigint)</code></td></tr><tr><td><code class="literal">>= (bigint,bigint)</code></td></tr><tr><td valign="middle"><code class="literal">interval_bloom_ops</code></td><td><code class="literal">= (interval,interval)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">interval_minmax_ops</code></td><td><code class="literal">= (interval,interval)</code></td></tr><tr><td><code class="literal">< (interval,interval)</code></td></tr><tr><td><code class="literal"><= (interval,interval)</code></td></tr><tr><td><code class="literal">> (interval,interval)</code></td></tr><tr><td><code class="literal">>= (interval,interval)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">interval_minmax_multi_ops</code></td><td><code class="literal">= (interval,interval)</code></td></tr><tr><td><code class="literal">< (interval,interval)</code></td></tr><tr><td><code class="literal"><= (interval,interval)</code></td></tr><tr><td><code class="literal">> (interval,interval)</code></td></tr><tr><td><code class="literal">>= (interval,interval)</code></td></tr><tr><td valign="middle"><code class="literal">macaddr_bloom_ops</code></td><td><code class="literal">= (macaddr,macaddr)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">macaddr_minmax_ops</code></td><td><code class="literal">= (macaddr,macaddr)</code></td></tr><tr><td><code class="literal">< (macaddr,macaddr)</code></td></tr><tr><td><code class="literal"><= (macaddr,macaddr)</code></td></tr><tr><td><code class="literal">> (macaddr,macaddr)</code></td></tr><tr><td><code class="literal">>= (macaddr,macaddr)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">macaddr_minmax_multi_ops</code></td><td><code class="literal">= (macaddr,macaddr)</code></td></tr><tr><td><code class="literal">< (macaddr,macaddr)</code></td></tr><tr><td><code class="literal"><= (macaddr,macaddr)</code></td></tr><tr><td><code class="literal">> (macaddr,macaddr)</code></td></tr><tr><td><code class="literal">>= (macaddr,macaddr)</code></td></tr><tr><td valign="middle"><code class="literal">macaddr8_bloom_ops</code></td><td><code class="literal">= (macaddr8,macaddr8)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">macaddr8_minmax_ops</code></td><td><code class="literal">= (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal">< (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal"><= (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal">> (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal">>= (macaddr8,macaddr8)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">macaddr8_minmax_multi_ops</code></td><td><code class="literal">= (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal">< (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal"><= (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal">> (macaddr8,macaddr8)</code></td></tr><tr><td><code class="literal">>= (macaddr8,macaddr8)</code></td></tr><tr><td valign="middle"><code class="literal">name_bloom_ops</code></td><td><code class="literal">= (name,name)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">name_minmax_ops</code></td><td><code class="literal">= (name,name)</code></td></tr><tr><td><code class="literal">< (name,name)</code></td></tr><tr><td><code class="literal"><= (name,name)</code></td></tr><tr><td><code class="literal">> (name,name)</code></td></tr><tr><td><code class="literal">>= (name,name)</code></td></tr><tr><td valign="middle"><code class="literal">numeric_bloom_ops</code></td><td><code class="literal">= (numeric,numeric)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">numeric_minmax_ops</code></td><td><code class="literal">= (numeric,numeric)</code></td></tr><tr><td><code class="literal">< (numeric,numeric)</code></td></tr><tr><td><code class="literal"><= (numeric,numeric)</code></td></tr><tr><td><code class="literal">> (numeric,numeric)</code></td></tr><tr><td><code class="literal">>= (numeric,numeric)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">numeric_minmax_multi_ops</code></td><td><code class="literal">= (numeric,numeric)</code></td></tr><tr><td><code class="literal">< (numeric,numeric)</code></td></tr><tr><td><code class="literal"><= (numeric,numeric)</code></td></tr><tr><td><code class="literal">> (numeric,numeric)</code></td></tr><tr><td><code class="literal">>= (numeric,numeric)</code></td></tr><tr><td valign="middle"><code class="literal">oid_bloom_ops</code></td><td><code class="literal">= (oid,oid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">oid_minmax_ops</code></td><td><code class="literal">= (oid,oid)</code></td></tr><tr><td><code class="literal">< (oid,oid)</code></td></tr><tr><td><code class="literal">> (oid,oid)</code></td></tr><tr><td><code class="literal"><= (oid,oid)</code></td></tr><tr><td><code class="literal">>= (oid,oid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">oid_minmax_multi_ops</code></td><td><code class="literal">= (oid,oid)</code></td></tr><tr><td><code class="literal">< (oid,oid)</code></td></tr><tr><td><code class="literal">> (oid,oid)</code></td></tr><tr><td><code class="literal"><= (oid,oid)</code></td></tr><tr><td><code class="literal">>= (oid,oid)</code></td></tr><tr><td valign="middle"><code class="literal">pg_lsn_bloom_ops</code></td><td><code class="literal">= (pg_lsn,pg_lsn)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">pg_lsn_minmax_ops</code></td><td><code class="literal">= (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal">< (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal">> (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal"><= (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal">>= (pg_lsn,pg_lsn)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">pg_lsn_minmax_multi_ops</code></td><td><code class="literal">= (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal">< (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal">> (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal"><= (pg_lsn,pg_lsn)</code></td></tr><tr><td><code class="literal">>= (pg_lsn,pg_lsn)</code></td></tr><tr><td rowspan="14" valign="middle"><code class="literal">range_inclusion_ops</code></td><td><code class="literal">= (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">< (anyrange,anyrange)</code></td></tr><tr><td><code class="literal"><= (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">>= (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">> (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">&& (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">@> (anyrange,anyelement)</code></td></tr><tr><td><code class="literal">@> (anyrange,anyrange)</code></td></tr><tr><td><code class="literal"><@ (anyrange,anyrange)</code></td></tr><tr><td><code class="literal"><< (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">>> (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">&< (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">&> (anyrange,anyrange)</code></td></tr><tr><td><code class="literal">-|- (anyrange,anyrange)</code></td></tr><tr><td valign="middle"><code class="literal">text_bloom_ops</code></td><td><code class="literal">= (text,text)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">text_minmax_ops</code></td><td><code class="literal">= (text,text)</code></td></tr><tr><td><code class="literal">< (text,text)</code></td></tr><tr><td><code class="literal"><= (text,text)</code></td></tr><tr><td><code class="literal">> (text,text)</code></td></tr><tr><td><code class="literal">>= (text,text)</code></td></tr><tr><td valign="middle"><code class="literal">tid_bloom_ops</code></td><td><code class="literal">= (tid,tid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">tid_minmax_ops</code></td><td><code class="literal">= (tid,tid)</code></td></tr><tr><td><code class="literal">< (tid,tid)</code></td></tr><tr><td><code class="literal">> (tid,tid)</code></td></tr><tr><td><code class="literal"><= (tid,tid)</code></td></tr><tr><td><code class="literal">>= (tid,tid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">tid_minmax_multi_ops</code></td><td><code class="literal">= (tid,tid)</code></td></tr><tr><td><code class="literal">< (tid,tid)</code></td></tr><tr><td><code class="literal">> (tid,tid)</code></td></tr><tr><td><code class="literal"><= (tid,tid)</code></td></tr><tr><td><code class="literal">>= (tid,tid)</code></td></tr><tr><td valign="middle"><code class="literal">timestamp_bloom_ops</code></td><td><code class="literal">= (timestamp,timestamp)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">timestamp_minmax_ops</code></td><td><code class="literal">= (timestamp,timestamp)</code></td></tr><tr><td><code class="literal">< (timestamp,timestamp)</code></td></tr><tr><td><code class="literal"><= (timestamp,timestamp)</code></td></tr><tr><td><code class="literal">> (timestamp,timestamp)</code></td></tr><tr><td><code class="literal">>= (timestamp,timestamp)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">timestamp_minmax_multi_ops</code></td><td><code class="literal">= (timestamp,timestamp)</code></td></tr><tr><td><code class="literal">< (timestamp,timestamp)</code></td></tr><tr><td><code class="literal"><= (timestamp,timestamp)</code></td></tr><tr><td><code class="literal">> (timestamp,timestamp)</code></td></tr><tr><td><code class="literal">>= (timestamp,timestamp)</code></td></tr><tr><td valign="middle"><code class="literal">timestamptz_bloom_ops</code></td><td><code class="literal">= (timestamptz,timestamptz)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">timestamptz_minmax_ops</code></td><td><code class="literal">= (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal">< (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal"><= (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal">> (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal">>= (timestamptz,timestamptz)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">timestamptz_minmax_multi_ops</code></td><td><code class="literal">= (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal">< (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal"><= (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal">> (timestamptz,timestamptz)</code></td></tr><tr><td><code class="literal">>= (timestamptz,timestamptz)</code></td></tr><tr><td valign="middle"><code class="literal">time_bloom_ops</code></td><td><code class="literal">= (time,time)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">time_minmax_ops</code></td><td><code class="literal">= (time,time)</code></td></tr><tr><td><code class="literal">< (time,time)</code></td></tr><tr><td><code class="literal"><= (time,time)</code></td></tr><tr><td><code class="literal">> (time,time)</code></td></tr><tr><td><code class="literal">>= (time,time)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">time_minmax_multi_ops</code></td><td><code class="literal">= (time,time)</code></td></tr><tr><td><code class="literal">< (time,time)</code></td></tr><tr><td><code class="literal"><= (time,time)</code></td></tr><tr><td><code class="literal">> (time,time)</code></td></tr><tr><td><code class="literal">>= (time,time)</code></td></tr><tr><td valign="middle"><code class="literal">timetz_bloom_ops</code></td><td><code class="literal">= (timetz,timetz)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">timetz_minmax_ops</code></td><td><code class="literal">= (timetz,timetz)</code></td></tr><tr><td><code class="literal">< (timetz,timetz)</code></td></tr><tr><td><code class="literal"><= (timetz,timetz)</code></td></tr><tr><td><code class="literal">> (timetz,timetz)</code></td></tr><tr><td><code class="literal">>= (timetz,timetz)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">timetz_minmax_multi_ops</code></td><td><code class="literal">= (timetz,timetz)</code></td></tr><tr><td><code class="literal">< (timetz,timetz)</code></td></tr><tr><td><code class="literal"><= (timetz,timetz)</code></td></tr><tr><td><code class="literal">> (timetz,timetz)</code></td></tr><tr><td><code class="literal">>= (timetz,timetz)</code></td></tr><tr><td valign="middle"><code class="literal">uuid_bloom_ops</code></td><td><code class="literal">= (uuid,uuid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">uuid_minmax_ops</code></td><td><code class="literal">= (uuid,uuid)</code></td></tr><tr><td><code class="literal">< (uuid,uuid)</code></td></tr><tr><td><code class="literal">> (uuid,uuid)</code></td></tr><tr><td><code class="literal"><= (uuid,uuid)</code></td></tr><tr><td><code class="literal">>= (uuid,uuid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">uuid_minmax_multi_ops</code></td><td><code class="literal">= (uuid,uuid)</code></td></tr><tr><td><code class="literal">< (uuid,uuid)</code></td></tr><tr><td><code class="literal">> (uuid,uuid)</code></td></tr><tr><td><code class="literal"><= (uuid,uuid)</code></td></tr><tr><td><code class="literal">>= (uuid,uuid)</code></td></tr><tr><td rowspan="5" valign="middle"><code class="literal">varbit_minmax_ops</code></td><td><code class="literal">= (varbit,varbit)</code></td></tr><tr><td><code class="literal">< (varbit,varbit)</code></td></tr><tr><td><code class="literal">> (varbit,varbit)</code></td></tr><tr><td><code class="literal"><= (varbit,varbit)</code></td></tr><tr><td><code class="literal">>= (varbit,varbit)</code></td></tr></tbody></table></div></div><br class="table-break" /><div class="sect3" id="BRIN-BUILTIN-OPCLASSES--PARAMETERS"><div class="titlepage"><div><div><h4 class="title">65.5.2.1. Operator Class Parameters <a href="#BRIN-BUILTIN-OPCLASSES--PARAMETERS" class="id_link">#</a></h4></div></div></div><p>
116 Some of the built-in operator classes allow specifying parameters affecting
117 behavior of the operator class. Each operator class has its own set of
118 allowed parameters. Only the <code class="literal">bloom</code> and <code class="literal">minmax-multi</code>
119 operator classes allow specifying parameters:
121 bloom operator classes accept these parameters:
122 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">n_distinct_per_range</code></span></dt><dd><p>
123 Defines the estimated number of distinct non-null values in the block
124 range, used by <acronym class="acronym">BRIN</acronym> bloom indexes for sizing of the
125 Bloom filter. It behaves similarly to <code class="literal">n_distinct</code> option
126 for <a class="xref" href="sql-altertable.html" title="ALTER TABLE"><span class="refentrytitle">ALTER TABLE</span></a>. When set to a positive value,
127 each block range is assumed to contain this number of distinct non-null
128 values. When set to a negative value, which must be greater than or
129 equal to -1, the number of distinct non-null values is assumed to grow linearly with
130 the maximum possible number of tuples in the block range (about 290
131 rows per block). The default value is <code class="literal">-0.1</code>, and
132 the minimum number of distinct non-null values is <code class="literal">16</code>.
133 </p></dd><dt><span class="term"><code class="literal">false_positive_rate</code></span></dt><dd><p>
134 Defines the desired false positive rate used by <acronym class="acronym">BRIN</acronym>
135 bloom indexes for sizing of the Bloom filter. The values must be
136 between 0.0001 and 0.25. The default value is 0.01, which is 1% false
138 </p></dd></dl></div><p>
139 minmax-multi operator classes accept these parameters:
140 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">values_per_range</code></span></dt><dd><p>
141 Defines the maximum number of values stored by <acronym class="acronym">BRIN</acronym>
142 minmax indexes to summarize a block range. Each value may represent
143 either a point, or a boundary of an interval. Values must be between
144 8 and 256, and the default value is 32.
145 </p></dd></dl></div></div></div><div class="sect2" id="BRIN-EXTENSIBILITY"><div class="titlepage"><div><div><h3 class="title">65.5.3. Extensibility <a href="#BRIN-EXTENSIBILITY" class="id_link">#</a></h3></div></div></div><p>
146 The <acronym class="acronym">BRIN</acronym> interface has a high level of abstraction,
147 requiring the access method implementer only to implement the semantics
148 of the data type being accessed. The <acronym class="acronym">BRIN</acronym> layer
149 itself takes care of concurrency, logging and searching the index structure.
151 All it takes to get a <acronym class="acronym">BRIN</acronym> access method working is to
152 implement a few user-defined methods, which define the behavior of
153 summary values stored in the index and the way they interact with
155 In short, <acronym class="acronym">BRIN</acronym> combines
156 extensibility with generality, code reuse, and a clean interface.
158 There are four methods that an operator class for <acronym class="acronym">BRIN</acronym>
161 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">BrinOpcInfo *opcInfo(Oid type_oid)</code></span></dt><dd><p>
162 Returns internal information about the indexed columns' summary data.
163 The return value must point to a palloc'd <code class="structname">BrinOpcInfo</code>,
164 which has this definition:
165 </p><pre class="programlisting">
166 typedef struct BrinOpcInfo
168 /* Number of columns stored in an index column of this opclass */
171 /* Opaque pointer for the opclass' private use */
174 /* Type cache entries of the stored columns */
175 TypeCacheEntry *oi_typcache[FLEXIBLE_ARRAY_MEMBER];
178 <code class="structname">BrinOpcInfo</code>.<code class="structfield">oi_opaque</code> can be used by the
179 operator class routines to pass information between support functions
180 during an index scan.
181 </p></dd><dt><span class="term"><code class="function">bool consistent(BrinDesc *bdesc, BrinValues *column,
182 ScanKey *keys, int nkeys)</code></span></dt><dd><p>
183 Returns whether all the ScanKey entries are consistent with the given
184 indexed values for a range.
185 The attribute number to use is passed as part of the scan key.
186 Multiple scan keys for the same attribute may be passed at once; the
187 number of entries is determined by the <code class="literal">nkeys</code> parameter.
188 </p></dd><dt><span class="term"><code class="function">bool consistent(BrinDesc *bdesc, BrinValues *column,
189 ScanKey key)</code></span></dt><dd><p>
190 Returns whether the ScanKey is consistent with the given indexed
192 The attribute number to use is passed as part of the scan key.
193 This is an older backward-compatible variant of the consistent function.
194 </p></dd><dt><span class="term"><code class="function">bool addValue(BrinDesc *bdesc, BrinValues *column,
195 Datum newval, bool isnull)</code></span></dt><dd><p>
196 Given an index tuple and an indexed value, modifies the indicated
197 attribute of the tuple so that it additionally represents the new value.
198 If any modification was done to the tuple, <code class="literal">true</code> is
200 </p></dd><dt><span class="term"><code class="function">bool unionTuples(BrinDesc *bdesc, BrinValues *a,
201 BrinValues *b)</code></span></dt><dd><p>
202 Consolidates two index tuples. Given two index tuples, modifies the
203 indicated attribute of the first of them so that it represents both tuples.
204 The second tuple is not modified.
205 </p></dd></dl></div><p>
207 An operator class for <acronym class="acronym">BRIN</acronym> can optionally specify the
210 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">void options(local_relopts *relopts)</code></span></dt><dd><p>
211 Defines a set of user-visible parameters that control operator class
214 The <code class="function">options</code> function is passed a pointer to a
215 <code class="structname">local_relopts</code> struct, which needs to be
216 filled with a set of operator class specific options. The options
217 can be accessed from other support functions using the
218 <code class="literal">PG_HAS_OPCLASS_OPTIONS()</code> and
219 <code class="literal">PG_GET_OPCLASS_OPTIONS()</code> macros.
221 Since both key extraction of indexed values and representation of the
222 key in <acronym class="acronym">BRIN</acronym> are flexible, they may depend on
223 user-specified parameters.
224 </p></dd></dl></div><p>
226 The core distribution includes support for four types of operator classes:
227 minmax, minmax-multi, inclusion and bloom. Operator class definitions
228 using them are shipped for in-core data types as appropriate. Additional
229 operator classes can be defined by the user for other data types using
230 equivalent definitions, without having to write any source code;
231 appropriate catalog entries being declared is enough. Note that
232 assumptions about the semantics of operator strategies are embedded in the
233 support functions' source code.
235 Operator classes that implement completely different semantics are also
236 possible, provided implementations of the four main support functions
237 described above are written. Note that backwards compatibility across major
238 releases is not guaranteed: for example, additional support functions might
239 be required in later releases.
241 To write an operator class for a data type that implements a totally
242 ordered set, it is possible to use the minmax support functions
243 alongside the corresponding operators, as shown in
244 <a class="xref" href="brin.html#BRIN-EXTENSIBILITY-MINMAX-TABLE" title="Table 65.5. Function and Support Numbers for Minmax Operator Classes">Table 65.5</a>.
245 All operator class members (functions and operators) are mandatory.
246 </p><div class="table" id="BRIN-EXTENSIBILITY-MINMAX-TABLE"><p class="title"><strong>Table 65.5. Function and Support Numbers for Minmax Operator Classes</strong></p><div class="table-contents"><table class="table" summary="Function and Support Numbers for Minmax Operator Classes" border="1"><colgroup><col class="col1" /><col class="col2" /></colgroup><thead><tr><th>Operator class member</th><th>Object</th></tr></thead><tbody><tr><td>Support Function 1</td><td>internal function <code class="function">brin_minmax_opcinfo()</code></td></tr><tr><td>Support Function 2</td><td>internal function <code class="function">brin_minmax_add_value()</code></td></tr><tr><td>Support Function 3</td><td>internal function <code class="function">brin_minmax_consistent()</code></td></tr><tr><td>Support Function 4</td><td>internal function <code class="function">brin_minmax_union()</code></td></tr><tr><td>Operator Strategy 1</td><td>operator less-than</td></tr><tr><td>Operator Strategy 2</td><td>operator less-than-or-equal-to</td></tr><tr><td>Operator Strategy 3</td><td>operator equal-to</td></tr><tr><td>Operator Strategy 4</td><td>operator greater-than-or-equal-to</td></tr><tr><td>Operator Strategy 5</td><td>operator greater-than</td></tr></tbody></table></div></div><br class="table-break" /><p>
247 To write an operator class for a complex data type which has values
248 included within another type, it's possible to use the inclusion support
249 functions alongside the corresponding operators, as shown
250 in <a class="xref" href="brin.html#BRIN-EXTENSIBILITY-INCLUSION-TABLE" title="Table 65.6. Function and Support Numbers for Inclusion Operator Classes">Table 65.6</a>. It requires
251 only a single additional function, which can be written in any language.
252 More functions can be defined for additional functionality. All operators
253 are optional. Some operators require other operators, as shown as
254 dependencies on the table.
255 </p><div class="table" id="BRIN-EXTENSIBILITY-INCLUSION-TABLE"><p class="title"><strong>Table 65.6. Function and Support Numbers for Inclusion Operator Classes</strong></p><div class="table-contents"><table class="table" summary="Function and Support Numbers for Inclusion Operator Classes" border="1"><colgroup><col class="col1" /><col class="col2" /><col class="col3" /></colgroup><thead><tr><th>Operator class member</th><th>Object</th><th>Dependency</th></tr></thead><tbody><tr><td>Support Function 1</td><td>internal function <code class="function">brin_inclusion_opcinfo()</code></td><td> </td></tr><tr><td>Support Function 2</td><td>internal function <code class="function">brin_inclusion_add_value()</code></td><td> </td></tr><tr><td>Support Function 3</td><td>internal function <code class="function">brin_inclusion_consistent()</code></td><td> </td></tr><tr><td>Support Function 4</td><td>internal function <code class="function">brin_inclusion_union()</code></td><td> </td></tr><tr><td>Support Function 11</td><td>function to merge two elements</td><td> </td></tr><tr><td>Support Function 12</td><td>optional function to check whether two elements are mergeable</td><td> </td></tr><tr><td>Support Function 13</td><td>optional function to check if an element is contained within another</td><td> </td></tr><tr><td>Support Function 14</td><td>optional function to check whether an element is empty</td><td> </td></tr><tr><td>Operator Strategy 1</td><td>operator left-of</td><td>Operator Strategy 4</td></tr><tr><td>Operator Strategy 2</td><td>operator does-not-extend-to-the-right-of</td><td>Operator Strategy 5</td></tr><tr><td>Operator Strategy 3</td><td>operator overlaps</td><td> </td></tr><tr><td>Operator Strategy 4</td><td>operator does-not-extend-to-the-left-of</td><td>Operator Strategy 1</td></tr><tr><td>Operator Strategy 5</td><td>operator right-of</td><td>Operator Strategy 2</td></tr><tr><td>Operator Strategy 6, 18</td><td>operator same-as-or-equal-to</td><td>Operator Strategy 7</td></tr><tr><td>Operator Strategy 7, 16, 24, 25</td><td>operator contains-or-equal-to</td><td> </td></tr><tr><td>Operator Strategy 8, 26, 27</td><td>operator is-contained-by-or-equal-to</td><td>Operator Strategy 3</td></tr><tr><td>Operator Strategy 9</td><td>operator does-not-extend-above</td><td>Operator Strategy 11</td></tr><tr><td>Operator Strategy 10</td><td>operator is-below</td><td>Operator Strategy 12</td></tr><tr><td>Operator Strategy 11</td><td>operator is-above</td><td>Operator Strategy 9</td></tr><tr><td>Operator Strategy 12</td><td>operator does-not-extend-below</td><td>Operator Strategy 10</td></tr><tr><td>Operator Strategy 20</td><td>operator less-than</td><td>Operator Strategy 5</td></tr><tr><td>Operator Strategy 21</td><td>operator less-than-or-equal-to</td><td>Operator Strategy 5</td></tr><tr><td>Operator Strategy 22</td><td>operator greater-than</td><td>Operator Strategy 1</td></tr><tr><td>Operator Strategy 23</td><td>operator greater-than-or-equal-to</td><td>Operator Strategy 1</td></tr></tbody></table></div></div><br class="table-break" /><p>
256 Support function numbers 1 through 10 are reserved for the BRIN internal
257 functions, so the SQL level functions start with number 11. Support
258 function number 11 is the main function required to build the index.
259 It should accept two arguments with the same data type as the operator class,
260 and return the union of them. The inclusion operator class can store union
261 values with different data types if it is defined with the
262 <code class="literal">STORAGE</code> parameter. The return value of the union
263 function should match the <code class="literal">STORAGE</code> data type.
265 Support function numbers 12 and 14 are provided to support
266 irregularities of built-in data types. Function number 12
267 is used to support network addresses from different families which
268 are not mergeable. Function number 14 is used to support
269 empty ranges. Function number 13 is an optional but
270 recommended one, which allows the new value to be checked before
271 it is passed to the union function. As the BRIN framework can shortcut
272 some operations when the union is not changed, using this
273 function can improve index performance.
275 To write an operator class for a data type that implements only an equality
276 operator and supports hashing, it is possible to use the bloom support procedures
277 alongside the corresponding operators, as shown in
278 <a class="xref" href="brin.html#BRIN-EXTENSIBILITY-BLOOM-TABLE" title="Table 65.7. Procedure and Support Numbers for Bloom Operator Classes">Table 65.7</a>.
279 All operator class members (procedures and operators) are mandatory.
280 </p><div class="table" id="BRIN-EXTENSIBILITY-BLOOM-TABLE"><p class="title"><strong>Table 65.7. Procedure and Support Numbers for Bloom Operator Classes</strong></p><div class="table-contents"><table class="table" summary="Procedure and Support Numbers for Bloom Operator Classes" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Operator class member</th><th>Object</th></tr></thead><tbody><tr><td>Support Procedure 1</td><td>internal function <code class="function">brin_bloom_opcinfo()</code></td></tr><tr><td>Support Procedure 2</td><td>internal function <code class="function">brin_bloom_add_value()</code></td></tr><tr><td>Support Procedure 3</td><td>internal function <code class="function">brin_bloom_consistent()</code></td></tr><tr><td>Support Procedure 4</td><td>internal function <code class="function">brin_bloom_union()</code></td></tr><tr><td>Support Procedure 5</td><td>internal function <code class="function">brin_bloom_options()</code></td></tr><tr><td>Support Procedure 11</td><td>function to compute hash of an element</td></tr><tr><td>Operator Strategy 1</td><td>operator equal-to</td></tr></tbody></table></div></div><br class="table-break" /><p>
281 Support procedure numbers 1-10 are reserved for the BRIN internal
282 functions, so the SQL level functions start with number 11. Support
283 function number 11 is the main function required to build the index.
284 It should accept one argument with the same data type as the operator class,
285 and return a hash of the value.
287 The minmax-multi operator class is also intended for data types implementing
288 a totally ordered set, and may be seen as a simple extension of the minmax
289 operator class. While minmax operator class summarizes values from each block
290 range into a single contiguous interval, minmax-multi allows summarization
291 into multiple smaller intervals to improve handling of outlier values.
292 It is possible to use the minmax-multi support procedures alongside the
293 corresponding operators, as shown in
294 <a class="xref" href="brin.html#BRIN-EXTENSIBILITY-MINMAX-MULTI-TABLE" title="Table 65.8. Procedure and Support Numbers for minmax-multi Operator Classes">Table 65.8</a>.
295 All operator class members (procedures and operators) are mandatory.
296 </p><div class="table" id="BRIN-EXTENSIBILITY-MINMAX-MULTI-TABLE"><p class="title"><strong>Table 65.8. Procedure and Support Numbers for minmax-multi Operator Classes</strong></p><div class="table-contents"><table class="table" summary="Procedure and Support Numbers for minmax-multi Operator Classes" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Operator class member</th><th>Object</th></tr></thead><tbody><tr><td>Support Procedure 1</td><td>internal function <code class="function">brin_minmax_multi_opcinfo()</code></td></tr><tr><td>Support Procedure 2</td><td>internal function <code class="function">brin_minmax_multi_add_value()</code></td></tr><tr><td>Support Procedure 3</td><td>internal function <code class="function">brin_minmax_multi_consistent()</code></td></tr><tr><td>Support Procedure 4</td><td>internal function <code class="function">brin_minmax_multi_union()</code></td></tr><tr><td>Support Procedure 5</td><td>internal function <code class="function">brin_minmax_multi_options()</code></td></tr><tr><td>Support Procedure 11</td><td>function to compute distance between two values (length of a range)</td></tr><tr><td>Operator Strategy 1</td><td>operator less-than</td></tr><tr><td>Operator Strategy 2</td><td>operator less-than-or-equal-to</td></tr><tr><td>Operator Strategy 3</td><td>operator equal-to</td></tr><tr><td>Operator Strategy 4</td><td>operator greater-than-or-equal-to</td></tr><tr><td>Operator Strategy 5</td><td>operator greater-than</td></tr></tbody></table></div></div><br class="table-break" /><p>
297 Both minmax and inclusion operator classes support cross-data-type
298 operators, though with these the dependencies become more complicated.
299 The minmax operator class requires a full set of operators to be
300 defined with both arguments having the same data type. It allows
301 additional data types to be supported by defining extra sets
302 of operators. Inclusion operator class operator strategies are dependent
303 on another operator strategy as shown in
304 <a class="xref" href="brin.html#BRIN-EXTENSIBILITY-INCLUSION-TABLE" title="Table 65.6. Function and Support Numbers for Inclusion Operator Classes">Table 65.6</a>, or the same
305 operator strategy as themselves. They require the dependency
306 operator to be defined with the <code class="literal">STORAGE</code> data type as the
307 left-hand-side argument and the other supported data type to be the
308 right-hand-side argument of the supported operator. See
309 <code class="literal">float4_minmax_ops</code> as an example of minmax, and
310 <code class="literal">box_inclusion_ops</code> as an example of inclusion.
311 </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gin.html" title="65.4. GIN Indexes">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="indextypes.html" title="Chapter 65. Built-in Index Access Methods">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="hash-index.html" title="65.6. Hash Indexes">Next</a></td></tr><tr><td width="40%" align="left" valign="top">65.4. GIN Indexes </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 65.6. Hash Indexes</td></tr></table></div></body></html>