Home Explore Blog CI



postgresql

10th chunk of `doc/src/sgml/pageinspect.sgml`
8c364a93f9692c1b1dde5e982a0e58d08bea1de75d91d4320000000100000dda
 0/1 | 0/0 |         1 | {leaf}
(1 row)
</screen>
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term>
     <function>gist_page_items(page bytea, index_oid regclass) returns setof record</function>
     <indexterm>
      <primary>gist_page_items</primary>
     </indexterm>
    </term>

    <listitem>
     <para>
      <function>gist_page_items</function> returns information about
      the data stored in a page of a <acronym>GiST</acronym> index.  For example:
<screen>
test=# SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx');
 itemoffset |   ctid    | itemlen | dead |             keys
------------+-----------+---------+------+-------------------------------
          1 | (1,65535) |      40 | f    | (p)=("(185,185),(1,1)")
          2 | (2,65535) |      40 | f    | (p)=("(370,370),(186,186)")
          3 | (3,65535) |      40 | f    | (p)=("(555,555),(371,371)")
          4 | (4,65535) |      40 | f    | (p)=("(740,740),(556,556)")
          5 | (5,65535) |      40 | f    | (p)=("(870,870),(741,741)")
          6 | (6,65535) |      40 | f    | (p)=("(1000,1000),(871,871)")
(6 rows)
</screen>
     </para>
    </listitem>
   </varlistentry>

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

    <listitem>
     <para>
      Same as <function>gist_page_items</function>, but returns the key data
      as a raw <type>bytea</type> blob.  Since it does not attempt to decode
      the key, it does not need to know which index is involved.  For
      example:
<screen>
test=# SELECT * FROM gist_page_items_bytea(get_raw_page('test_gist_idx', 0));
 itemoffset |   ctid    | itemlen | dead |                                      key_data
------------+-----------+---------+------+-----------------------------------------&zwsp;-------------------------------------------
          1 | (1,65535) |      40 | f    | \x00000100ffff28000000000000c0644000000000&zwsp;00c06440000000000000f03f000000000000f03f
          2 | (2,65535) |      40 | f    | \x00000200ffff28000000000000c0744000000000&zwsp;00c074400000000000e064400000000000e06440
          3 | (3,65535) |      40 | f    | \x00000300ffff28000000000000207f4000000000&zwsp;00207f400000000000d074400000000000d07440
          4 | (4,65535) |      40 | f    | \x00000400ffff28000000000000c0844000000000&zwsp;00c084400000000000307f400000000000307f40
          5 | (5,65535) |      40 | f    | \x00000500ffff28000000000000f0894000000000&zwsp;00f089400000000000c884400000000000c88440
          6 | (6,65535) |      40 | f    | \x00000600ffff28000000000000208f4000000000&zwsp;00208f400000000000f889400000000000f88940
          7 | (7,65535) |      40 | f    | \x00000700ffff28000000000000408f4000000000&zwsp;00408f400000000000288f400000000000288f40
(7 rows)
</screen>
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </sect2>

 <sect2 id="pageinspect-hash-funcs">
  <title>Hash Functions</title>

  <variablelist>
   <varlistentry>
    <term>
     <function>hash_page_type(page bytea) returns text</function>
     <indexterm>
      <primary>hash_page_type</primary>
     </indexterm>
    </term>

    <listitem>
     <para>
      <function>hash_page_type</function> returns page type of
      the given <acronym>HASH</acronym> index page.  For example:
<screen>
test=# SELECT hash_page_type(get_raw_page('con_hash_index', 0));
 hash_page_type
----------------

Title: Page Inspection Functions
Summary
The pageinspect module provides various functions to inspect and analyze index pages, including GiST and HASH indexes, such as gist_page_items, gist_page_items_bytea, and hash_page_type, which return information about page data, item details, and page types, allowing for a deeper understanding of index structure and operation.