diff options
Diffstat (limited to 'doc/src/sgml/html/brin-intro.html')
-rw-r--r-- | doc/src/sgml/html/brin-intro.html | 75 |
1 files changed, 75 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..5cf1623 --- /dev/null +++ b/doc/src/sgml/html/brin-intro.html @@ -0,0 +1,75 @@ +<?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>67.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 V1.79.1" /><link rel="prev" href="brin.html" title="Chapter 67. BRIN Indexes" /><link rel="next" href="brin-builtin-opclasses.html" title="67.2. Built-in Operator Classes" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">67.1. Introduction</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="brin.html" title="Chapter 67. BRIN Indexes">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="brin.html" title="Chapter 67. BRIN Indexes">Up</a></td><th width="60%" align="center">Chapter 67. BRIN Indexes</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html" title="67.2. Built-in Operator Classes">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="BRIN-INTRO"><div class="titlepage"><div><div><h2 class="title" style="clear: both">67.1. Introduction</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="brin-intro.html#BRIN-OPERATION">67.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. + A <em class="firstterm">block range</em> 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">67.1.1. Index Maintenance</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, that range does not automatically acquire a summary + tuple; those tuples remain unsummarized until a summarization run is + invoked later, creating initial summaries. + This process can be invoked manually using the + <code class="function">brin_summarize_range(regclass, bigint)</code> or + <code class="function">brin_summarize_new_values(regclass)</code> functions; + automatically when <code class="command">VACUUM</code> processes the table; + or by automatic summarization executed by autovacuum, as insertions + occur. (This last trigger is disabled by default and can be enabled + with the <code class="literal">autosummarize</code> parameter.) + 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. + </p><p> + When autosummarization is enabled, each time a page range is filled a + request is sent to autovacuum for it to execute a targeted summarization + for that range, to be fulfilled at the end of the next worker run on 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 be summarized normally during the next + regular vacuum of the table. + </p></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="brin.html" title="Chapter 67. BRIN Indexes">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="brin.html" title="Chapter 67. BRIN Indexes">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html" title="67.2. Built-in Operator Classes">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 67. BRIN Indexes </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 67.2. Built-in Operator Classes</td></tr></table></div></body></html>
\ No newline at end of file |