diff options
Diffstat (limited to 'doc/src/sgml/html/brin-intro.html')
-rw-r--r-- | doc/src/sgml/html/brin-intro.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/doc/src/sgml/html/brin-intro.html b/doc/src/sgml/html/brin-intro.html new file mode 100644 index 0000000..340c629 --- /dev/null +++ b/doc/src/sgml/html/brin-intro.html @@ -0,0 +1,99 @@ +<?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>71.1. Introduction</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="brin.html" title="Chapter 71. BRIN Indexes" /><link rel="next" href="brin-builtin-opclasses.html" title="71.2. Built-in Operator Classes" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">71.1. Introduction</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="brin.html" title="Chapter 71. BRIN Indexes">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="brin.html" title="Chapter 71. BRIN Indexes">Up</a></td><th width="60%" align="center">Chapter 71. BRIN Indexes</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.2 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html" title="71.2. Built-in Operator Classes">Next</a></td></tr></table><hr /></div><div class="sect1" id="BRIN-INTRO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">71.1. Introduction <a href="#BRIN-INTRO" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="brin-intro.html#BRIN-OPERATION">71.1.1. Index Maintenance</a></span></dt></dl></div><p> + <acronym class="acronym">BRIN</acronym> stands for Block Range Index. + <acronym class="acronym">BRIN</acronym> is designed for handling very large tables + in which certain columns have some natural correlation with their + physical location within the table. + </p><p> + <acronym class="acronym">BRIN</acronym> works in terms of <em class="firstterm">block ranges</em> + (or <span class="quote">“<span class="quote">page ranges</span>”</span>). + A block range is a group of pages that are physically + adjacent in the table; for each block range, some summary info is stored + by the index. + For example, a table storing a store's sale orders might have + a date column on which each order was placed, and most of the time + the entries for earlier orders will appear earlier in the table as well; + a table storing a ZIP code column might have all codes for a city + grouped together naturally. + </p><p> + <acronym class="acronym">BRIN</acronym> indexes can satisfy queries via regular bitmap + index scans, and will return all tuples in all pages within each range if + the summary info stored by the index is <em class="firstterm">consistent</em> with the + query conditions. + The query executor is in charge of rechecking these tuples and discarding + those that do not match the query conditions — in other words, these + indexes are lossy. + Because a <acronym class="acronym">BRIN</acronym> index is very small, scanning the index + adds little overhead compared to a sequential scan, but may avoid scanning + large parts of the table that are known not to contain matching tuples. + </p><p> + The specific data that a <acronym class="acronym">BRIN</acronym> index will store, + as well as the specific queries that the index will be able to satisfy, + depend on the operator class selected for each column of the index. + Data types having a linear sort order can have operator classes that + store the minimum and maximum value within each block range, for instance; + geometrical types might store the bounding box for all the objects + in the block range. + </p><p> + The size of the block range is determined at index creation time by + the <code class="literal">pages_per_range</code> storage parameter. The number of index + entries will be equal to the size of the relation in pages divided by + the selected value for <code class="literal">pages_per_range</code>. Therefore, the smaller + the number, the larger the index becomes (because of the need to + store more index entries), but at the same time the summary data stored can + be more precise and more data blocks can be skipped during an index scan. + </p><div class="sect2" id="BRIN-OPERATION"><div class="titlepage"><div><div><h3 class="title">71.1.1. Index Maintenance <a href="#BRIN-OPERATION" class="id_link">#</a></h3></div></div></div><p> + At the time of creation, all existing heap pages are scanned and a + summary index tuple is created for each range, including the + possibly-incomplete range at the end. + As new pages are filled with data, page ranges that are already + summarized will cause the summary information to be updated with data + from the new tuples. + When a new page is created that does not fall within the last + summarized range, the range that the new page belongs to + does not automatically acquire a summary tuple; + those tuples remain unsummarized until a summarization run is + invoked later, creating the initial summary for that range. + </p><p> + There are several ways to trigger the initial summarization of a page range. + If the table is vacuumed, either manually or by + <a class="link" href="routine-vacuuming.html#AUTOVACUUM" title="25.1.6. The Autovacuum Daemon">autovacuum</a>, all existing unsummarized + page ranges are summarized. + Also, if the index's + <a class="xref" href="sql-createindex.html#INDEX-RELOPTION-AUTOSUMMARIZE">autosummarize</a> parameter is enabled, + which it isn't by default, + whenever autovacuum runs in that database, summarization will occur for all + unsummarized page ranges that have been filled, + regardless of whether the table itself is processed by autovacuum; see below. + </p><p> + Lastly, the following functions can be used: + </p><table border="0" summary="Simple list" class="simplelist"><tr><td> + <code class="function">brin_summarize_new_values(regclass)</code> + which summarizes all unsummarized ranges; + </td></tr><tr><td> + <code class="function">brin_summarize_range(regclass, bigint)</code> + which summarizes only the range containing the given page, + if it is unsummarized. + </td></tr></table><p> + </p><p> + When autosummarization is enabled, a request is sent to + <code class="literal">autovacuum</code> to execute a targeted summarization + for a block range when an insertion is detected for the first item + of the first page of the next block range, + to be fulfilled the next time an autovacuum + worker finishes running in the + same database. If the request queue is full, the request is not recorded + and a message is sent to the server log: +</p><pre class="screen"> +LOG: request for BRIN range summarization for index "brin_wi_idx" page 128 was not recorded +</pre><p> + When this happens, the range will remain unsummarized until the next + regular vacuum run on the table, or one of the functions mentioned above + are invoked. + </p><p> + Conversely, a range can be de-summarized using the + <code class="function">brin_desummarize_range(regclass, bigint)</code> function, + which is useful when the index tuple is no longer a very good + representation because the existing values have changed. + See <a class="xref" href="functions-admin.html#FUNCTIONS-ADMIN-INDEX" title="9.27.8. Index Maintenance Functions">Section 9.27.8</a> for details. + </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="brin.html" title="Chapter 71. BRIN Indexes">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="brin.html" title="Chapter 71. BRIN Indexes">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html" title="71.2. Built-in Operator Classes">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 71. BRIN Indexes </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.2 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 71.2. Built-in Operator Classes</td></tr></table></div></body></html>
\ No newline at end of file |