Home Explore Blog CI



postgresql

8th chunk of `doc/src/sgml/pageinspect.sgml`
e2abf9149200c36aad81f0bcc42cb8024c26c9ced7ebb0740000000100000fa0
 </term>

    <listitem>
     <para>
      <function>brin_metapage_info</function> returns assorted information
      about a <acronym>BRIN</acronym> index metapage.  For example:
<screen>
test=# SELECT * FROM brin_metapage_info(get_raw_page('brinidx', 0));
   magic    | version | pagesperrange | lastrevmappage
------------+---------+---------------+----------------
 0xA8109CFA |       1 |             4 |              2
</screen>
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>brin_revmap_data(page bytea) returns setof tid</function>
     <indexterm>
      <primary>brin_revmap_data</primary>
     </indexterm>
    </term>

    <listitem>
     <para>
      <function>brin_revmap_data</function> returns the list of tuple
      identifiers in a <acronym>BRIN</acronym> index range map page.
      For example:
<screen>
test=# SELECT * FROM brin_revmap_data(get_raw_page('brinidx', 2)) LIMIT 5;
  pages
---------
 (6,137)
 (6,138)
 (6,139)
 (6,140)
 (6,141)
</screen>
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>brin_page_items(page bytea, index oid) returns setof record</function>
     <indexterm>
      <primary>brin_page_items</primary>
     </indexterm>
    </term>

    <listitem>
     <para>
      <function>brin_page_items</function> returns the data stored in the
      <acronym>BRIN</acronym> data page.  For example:
<screen>
test=# SELECT * FROM brin_page_items(get_raw_page('brinidx', 5),
                                     'brinidx')
       ORDER BY blknum, attnum LIMIT 6;
 itemoffset | blknum | attnum | allnulls | hasnulls | placeholder | empty |    value
------------+--------+--------+----------+----------+-------------+-------+--------------
        137 |      0 |      1 | t        | f        | f           | f     |
        137 |      0 |      2 | f        | f        | f           | f     | {1 .. 88}
        138 |      4 |      1 | t        | f        | f           | f     |
        138 |      4 |      2 | f        | f        | f           | f     | {89 .. 176}
        139 |      8 |      1 | t        | f        | f           | f     |
        139 |      8 |      2 | f        | f        | f           | f     | {177 .. 264}
</screen>
      The returned columns correspond to the fields in the
      <structname>BrinMemTuple</structname> and <structname>BrinValues</structname> structs.
      See <filename>src/include/access/brin_tuple.h</filename> for details.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </sect2>

 <sect2 id="pageinspect-gin-funcs">
  <title>GIN Functions</title>

  <variablelist>
   <varlistentry>
    <term>
     <function>gin_metapage_info(page bytea) returns record</function>
     <indexterm>
      <primary>gin_metapage_info</primary>
     </indexterm>
    </term>

    <listitem>
     <para>
      <function>gin_metapage_info</function> returns information about
      a <acronym>GIN</acronym> index metapage.  For example:
<screen>
test=# SELECT * FROM gin_metapage_info(get_raw_page('gin_index', 0));
-[ RECORD 1 ]----+-----------
pending_head     | 4294967295
pending_tail     | 4294967295
tail_free_size   | 0
n_pending_pages  | 0
n_pending_tuples | 0
n_total_pages    | 7
n_entry_pages    | 6
n_data_pages     | 0
n_entries        | 693
version          | 2
</screen>
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>gin_page_opaque_info(page bytea) returns record</function>
     <indexterm>
      <primary>gin_page_opaque_info</primary>
     </indexterm>
    </term>

    <listitem>
     <para>
      <function>gin_page_opaque_info</function> returns information about
      a <acronym>GIN</acronym> index opaque area, like the page type.
      For example:
<screen>
test=# SELECT * FROM gin_page_opaque_info(get_raw_page('gin_index', 2));
 rightlink | maxoff |         flags
-----------+--------+------------------------
         5 |      0 | {data,leaf,compressed}
(1

Title: GIN Functions
Summary
The pageinspect module provides functions to inspect and analyze GIN index pages, including gin_metapage_info and gin_page_opaque_info, which return information about metapages and opaque areas, such as pending pages, total pages, and page types, allowing for a deeper understanding of GIN index structure and operation.