gooderp18绿色标准版
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

75 lines
6.8KB

  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>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><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 12.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>
  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.
  7. A <em class="firstterm">block range</em> is a group of pages that are physically
  8. adjacent in the table; for each block range, some summary info is stored
  9. by the index.
  10. For example, a table storing a store's sale orders might have
  11. a date column on which each order was placed, and most of the time
  12. the entries for earlier orders will appear earlier in the table as well;
  13. a table storing a ZIP code column might have all codes for a city
  14. grouped together naturally.
  15. </p><p>
  16. <acronym class="acronym">BRIN</acronym> indexes can satisfy queries via regular bitmap
  17. index scans, and will return all tuples in all pages within each range if
  18. the summary info stored by the index is <em class="firstterm">consistent</em> with the
  19. query conditions.
  20. The query executor is in charge of rechecking these tuples and discarding
  21. those that do not match the query conditions — in other words, these
  22. indexes are lossy.
  23. Because a <acronym class="acronym">BRIN</acronym> index is very small, scanning the index
  24. adds little overhead compared to a sequential scan, but may avoid scanning
  25. large parts of the table that are known not to contain matching tuples.
  26. </p><p>
  27. The specific data that a <acronym class="acronym">BRIN</acronym> index will store,
  28. as well as the specific queries that the index will be able to satisfy,
  29. depend on the operator class selected for each column of the index.
  30. Data types having a linear sort order can have operator classes that
  31. store the minimum and maximum value within each block range, for instance;
  32. geometrical types might store the bounding box for all the objects
  33. in the block range.
  34. </p><p>
  35. The size of the block range is determined at index creation time by
  36. the <code class="literal">pages_per_range</code> storage parameter. The number of index
  37. entries will be equal to the size of the relation in pages divided by
  38. the selected value for <code class="literal">pages_per_range</code>. Therefore, the smaller
  39. the number, the larger the index becomes (because of the need to
  40. store more index entries), but at the same time the summary data stored can
  41. be more precise and more data blocks can be skipped during an index scan.
  42. </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>
  43. At the time of creation, all existing heap pages are scanned and a
  44. summary index tuple is created for each range, including the
  45. possibly-incomplete range at the end.
  46. As new pages are filled with data, page ranges that are already
  47. summarized will cause the summary information to be updated with data
  48. from the new tuples.
  49. When a new page is created that does not fall within the last
  50. summarized range, that range does not automatically acquire a summary
  51. tuple; those tuples remain unsummarized until a summarization run is
  52. invoked later, creating initial summaries.
  53. This process can be invoked manually using the
  54. <code class="function">brin_summarize_range(regclass, bigint)</code> or
  55. <code class="function">brin_summarize_new_values(regclass)</code> functions;
  56. automatically when <code class="command">VACUUM</code> processes the table;
  57. or by automatic summarization executed by autovacuum, as insertions
  58. occur. (This last trigger is disabled by default and can be enabled
  59. with the <code class="literal">autosummarize</code> parameter.)
  60. Conversely, a range can be de-summarized using the
  61. <code class="function">brin_desummarize_range(regclass, bigint)</code> function,
  62. which is useful when the index tuple is no longer a very good
  63. representation because the existing values have changed.
  64. </p><p>
  65. When autosummarization is enabled, each time a page range is filled a
  66. request is sent to autovacuum for it to execute a targeted summarization
  67. for that range, to be fulfilled at the end of the next worker run on the
  68. same database. If the request queue is full, the request is not recorded
  69. and a message is sent to the server log:
  70. </p><pre class="screen">
  71. LOG: request for BRIN range summarization for index "brin_wi_idx" page 128 was not recorded
  72. </pre><p>
  73. When this happens, the range will be summarized normally during the next
  74. regular vacuum of the table.
  75. </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">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="brin.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="brin-builtin-opclasses.html">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">Home</a></td><td width="40%" align="right" valign="top"> 67.2. Built-in Operator Classes</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1