diff options
Diffstat (limited to 'doc/src/sgml/html/pageinspect.html')
-rw-r--r-- | doc/src/sgml/html/pageinspect.html | 605 |
1 files changed, 605 insertions, 0 deletions
diff --git a/doc/src/sgml/html/pageinspect.html b/doc/src/sgml/html/pageinspect.html new file mode 100644 index 0000000..b3dd634 --- /dev/null +++ b/doc/src/sgml/html/pageinspect.html @@ -0,0 +1,605 @@ +<?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>F.25. pageinspect — low-level inspection of database pages</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="oldsnapshot.html" title="F.24. old_snapshot — inspect old_snapshot_threshold state" /><link rel="next" href="passwordcheck.html" title="F.26. passwordcheck — verify password strength" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.25. pageinspect — low-level inspection of database pages</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="oldsnapshot.html" title="F.24. old_snapshot — inspect old_snapshot_threshold state">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</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="passwordcheck.html" title="F.26. passwordcheck — verify password strength">Next</a></td></tr></table><hr /></div><div class="sect1" id="PAGEINSPECT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.25. pageinspect — low-level inspection of database pages <a href="#PAGEINSPECT" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-GENERAL-FUNCS">F.25.1. General Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-HEAP-FUNCS">F.25.2. Heap Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-B-TREE-FUNCS">F.25.3. B-Tree Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-BRIN-FUNCS">F.25.4. BRIN Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-GIN-FUNCS">F.25.5. GIN Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-GIST-FUNCS">F.25.6. GiST Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#PAGEINSPECT-HASH-FUNCS">F.25.7. Hash Functions</a></span></dt></dl></div><a id="id-1.11.7.35.2" class="indexterm"></a><p> + The <code class="filename">pageinspect</code> module provides functions that allow you to + inspect the contents of database pages at a low level, which is useful for + debugging purposes. All of these functions may be used only by superusers. + </p><div class="sect2" id="PAGEINSPECT-GENERAL-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.1. General Functions <a href="#PAGEINSPECT-GENERAL-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">get_raw_page(relname text, fork text, blkno bigint) returns bytea</code> + <a id="id-1.11.7.35.4.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">get_raw_page</code> reads the specified block of the named + relation and returns a copy as a <code class="type">bytea</code> value. This allows a + single time-consistent copy of the block to be obtained. + <em class="replaceable"><code>fork</code></em> should be <code class="literal">'main'</code> for + the main data fork, <code class="literal">'fsm'</code> for the + <a class="link" href="storage-fsm.html" title="73.3. Free Space Map">free space map</a>, + <code class="literal">'vm'</code> for the + <a class="link" href="storage-vm.html" title="73.4. Visibility Map">visibility map</a>, or + <code class="literal">'init'</code> for the initialization fork. + </p></dd><dt><span class="term"> + <code class="function">get_raw_page(relname text, blkno bigint) returns bytea</code> + </span></dt><dd><p> + A shorthand version of <code class="function">get_raw_page</code>, for reading + from the main fork. Equivalent to + <code class="literal">get_raw_page(relname, 'main', blkno)</code> + </p></dd><dt><span class="term"> + <code class="function">page_header(page bytea) returns record</code> + <a id="id-1.11.7.35.4.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">page_header</code> shows fields that are common to all + <span class="productname">PostgreSQL</span> heap and index pages. + </p><p> + A page image obtained with <code class="function">get_raw_page</code> should be + passed as argument. For example: +</p><pre class="screen"> +test=# SELECT * FROM page_header(get_raw_page('pg_class', 0)); + lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid +-----------+----------+--------+-------+-------+---------+----------+---------+----------- + 0/24A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0 +</pre><p> + The returned columns correspond to the fields in the + <code class="structname">PageHeaderData</code> struct. + See <code class="filename">src/include/storage/bufpage.h</code> for details. + </p><p> + The <code class="structfield">checksum</code> field is the checksum stored in + the page, which might be incorrect if the page is somehow corrupted. If + data checksums are not enabled for this instance, then the value stored + is meaningless. + </p></dd><dt><span class="term"> + <code class="function">page_checksum(page bytea, blkno bigint) returns smallint</code> + <a id="id-1.11.7.35.4.2.4.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">page_checksum</code> computes the checksum for the page, as if + it was located at the given block. + </p><p> + A page image obtained with <code class="function">get_raw_page</code> should be + passed as argument. For example: +</p><pre class="screen"> +test=# SELECT page_checksum(get_raw_page('pg_class', 0), 0); + page_checksum +--------------- + 13443 +</pre><p> + Note that the checksum depends on the block number, so matching block + numbers should be passed (except when doing esoteric debugging). + </p><p> + The checksum computed with this function can be compared with + the <code class="structfield">checksum</code> result field of the + function <code class="function">page_header</code>. If data checksums are + enabled for this instance, then the two values should be equal. + </p></dd><dt><span class="term"> + <code class="function">fsm_page_contents(page bytea) returns text</code> + <a id="id-1.11.7.35.4.2.5.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">fsm_page_contents</code> shows the internal node structure + of an <acronym class="acronym">FSM</acronym> page. For example: +</p><pre class="screen"> +test=# SELECT fsm_page_contents(get_raw_page('pg_class', 'fsm', 0)); +</pre><p> + The output is a multiline string, with one line per node in the binary + tree within the page. Only those nodes that are not zero are printed. + The so-called "next" pointer, which points to the next slot to be + returned from the page, is also printed. + </p><p> + See <code class="filename">src/backend/storage/freespace/README</code> for more + information on the structure of an <acronym class="acronym">FSM</acronym> page. + </p></dd></dl></div></div><div class="sect2" id="PAGEINSPECT-HEAP-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.2. Heap Functions <a href="#PAGEINSPECT-HEAP-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">heap_page_items(page bytea) returns setof record</code> + <a id="id-1.11.7.35.5.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">heap_page_items</code> shows all line pointers on a heap + page. For those line pointers that are in use, tuple headers as well + as tuple raw data are also shown. All tuples are shown, whether or not + the tuples were visible to an MVCC snapshot at the time the raw page + was copied. + </p><p> + A heap page image obtained with <code class="function">get_raw_page</code> should + be passed as argument. For example: +</p><pre class="screen"> +test=# SELECT * FROM heap_page_items(get_raw_page('pg_class', 0)); +</pre><p> + See <code class="filename">src/include/storage/itemid.h</code> and + <code class="filename">src/include/access/htup_details.h</code> for explanations of the fields + returned. + </p><p> + The <code class="function">heap_tuple_infomask_flags</code> function can be + used to unpack the flag bits of <code class="structfield">t_infomask</code> + and <code class="structfield">t_infomask2</code> for heap tuples. + </p></dd><dt><span class="term"> + <code class="function">tuple_data_split(rel_oid oid, t_data bytea, t_infomask integer, t_infomask2 integer, t_bits text [, do_detoast bool]) returns bytea[]</code> + <a id="id-1.11.7.35.5.2.2.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">tuple_data_split</code> splits tuple data into attributes + in the same way as backend internals. +</p><pre class="screen"> +test=# SELECT tuple_data_split('pg_class'::regclass, t_data, t_infomask, t_infomask2, t_bits) FROM heap_page_items(get_raw_page('pg_class', 0)); +</pre><p> + This function should be called with the same arguments as the return + attributes of <code class="function">heap_page_items</code>. + </p><p> + If <em class="parameter"><code>do_detoast</code></em> is <code class="literal">true</code>, + attributes will be detoasted as needed. Default value is + <code class="literal">false</code>. + </p></dd><dt><span class="term"> + <code class="function">heap_page_item_attrs(page bytea, rel_oid regclass [, do_detoast bool]) returns setof record</code> + <a id="id-1.11.7.35.5.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">heap_page_item_attrs</code> is equivalent to + <code class="function">heap_page_items</code> except that it returns + tuple raw data as an array of attributes that can optionally + be detoasted by <em class="parameter"><code>do_detoast</code></em> which is + <code class="literal">false</code> by default. + </p><p> + A heap page image obtained with <code class="function">get_raw_page</code> should + be passed as argument. For example: +</p><pre class="screen"> +test=# SELECT * FROM heap_page_item_attrs(get_raw_page('pg_class', 0), 'pg_class'::regclass); +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">heap_tuple_infomask_flags(t_infomask integer, t_infomask2 integer) returns record</code> + <a id="id-1.11.7.35.5.2.4.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">heap_tuple_infomask_flags</code> decodes the + <code class="structfield">t_infomask</code> and + <code class="structfield">t_infomask2</code> returned by + <code class="function">heap_page_items</code> into a human-readable + set of arrays made of flag names, with one column for all + the flags and one column for combined flags. For example: +</p><pre class="screen"> +test=# SELECT t_ctid, raw_flags, combined_flags + FROM heap_page_items(get_raw_page('pg_class', 0)), + LATERAL heap_tuple_infomask_flags(t_infomask, t_infomask2) + WHERE t_infomask IS NOT NULL OR t_infomask2 IS NOT NULL; +</pre><p> + This function should be called with the same arguments as the return + attributes of <code class="function">heap_page_items</code>. + </p><p> + Combined flags are displayed for source-level macros that take into + account the value of more than one raw bit, such as + <code class="literal">HEAP_XMIN_FROZEN</code>. + </p><p> + See <code class="filename">src/include/access/htup_details.h</code> for + explanations of the flag names returned. + </p></dd></dl></div></div><div class="sect2" id="PAGEINSPECT-B-TREE-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.3. B-Tree Functions <a href="#PAGEINSPECT-B-TREE-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">bt_metap(relname text) returns record</code> + <a id="id-1.11.7.35.6.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">bt_metap</code> returns information about a B-tree + index's metapage. For example: +</p><pre class="screen"> +test=# SELECT * FROM bt_metap('pg_cast_oid_index'); +-[ RECORD 1 ]-------------+------- +magic | 340322 +version | 4 +root | 1 +level | 0 +fastroot | 1 +fastlevel | 0 +last_cleanup_num_delpages | 0 +last_cleanup_num_tuples | 230 +allequalimage | f +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">bt_page_stats(relname text, blkno bigint) returns record</code> + <a id="id-1.11.7.35.6.2.2.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">bt_page_stats</code> returns summary information about + a data page of a B-tree index. For example: +</p><pre class="screen"> +test=# SELECT * FROM bt_page_stats('pg_cast_oid_index', 1); +-[ RECORD 1 ]-+----- +blkno | 1 +type | l +live_items | 224 +dead_items | 0 +avg_item_size | 16 +page_size | 8192 +free_size | 3668 +btpo_prev | 0 +btpo_next | 0 +btpo_level | 0 +btpo_flags | 3 +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">bt_multi_page_stats(relname text, blkno bigint, blk_count bigint) returns setof record</code> + <a id="id-1.11.7.35.6.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">bt_multi_page_stats</code> returns the same information + as <code class="function">bt_page_stats</code>, but does so for each page of the + range of pages beginning at <em class="parameter"><code>blkno</code></em> and extending + for <em class="parameter"><code>blk_count</code></em> pages. + If <em class="parameter"><code>blk_count</code></em> is negative, all pages + from <em class="parameter"><code>blkno</code></em> to the end of the index are reported + on. For example: +</p><pre class="screen"> +test=# SELECT * FROM bt_multi_page_stats('pg_proc_oid_index', 5, 2); +-[ RECORD 1 ]-+----- +blkno | 5 +type | l +live_items | 367 +dead_items | 0 +avg_item_size | 16 +page_size | 8192 +free_size | 808 +btpo_prev | 4 +btpo_next | 6 +btpo_level | 0 +btpo_flags | 1 +-[ RECORD 2 ]-+----- +blkno | 6 +type | l +live_items | 367 +dead_items | 0 +avg_item_size | 16 +page_size | 8192 +free_size | 808 +btpo_prev | 5 +btpo_next | 7 +btpo_level | 0 +btpo_flags | 1 +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">bt_page_items(relname text, blkno bigint) returns setof record</code> + <a id="id-1.11.7.35.6.2.4.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">bt_page_items</code> returns detailed information about + all of the items on a B-tree index page. For example: +</p><pre class="screen"> +test=# SELECT itemoffset, ctid, itemlen, nulls, vars, data, dead, htid, tids[0:2] AS some_tids + FROM bt_page_items('tenk2_hundred', 5); + itemoffset | ctid | itemlen | nulls | vars | data | dead | htid | some_tids +------------+-----------+---------+-------+------+-------------------------+------+--------+--------------------- + 1 | (16,1) | 16 | f | f | 30 00 00 00 00 00 00 00 | | | + 2 | (16,8292) | 616 | f | f | 24 00 00 00 00 00 00 00 | f | (1,6) | {"(1,6)","(10,22)"} + 3 | (16,8292) | 616 | f | f | 25 00 00 00 00 00 00 00 | f | (1,18) | {"(1,18)","(4,22)"} + 4 | (16,8292) | 616 | f | f | 26 00 00 00 00 00 00 00 | f | (4,18) | {"(4,18)","(6,17)"} + 5 | (16,8292) | 616 | f | f | 27 00 00 00 00 00 00 00 | f | (1,2) | {"(1,2)","(1,19)"} + 6 | (16,8292) | 616 | f | f | 28 00 00 00 00 00 00 00 | f | (2,24) | {"(2,24)","(4,11)"} + 7 | (16,8292) | 616 | f | f | 29 00 00 00 00 00 00 00 | f | (2,17) | {"(2,17)","(11,2)"} + 8 | (16,8292) | 616 | f | f | 2a 00 00 00 00 00 00 00 | f | (0,25) | {"(0,25)","(3,20)"} + 9 | (16,8292) | 616 | f | f | 2b 00 00 00 00 00 00 00 | f | (0,10) | {"(0,10)","(0,14)"} + 10 | (16,8292) | 616 | f | f | 2c 00 00 00 00 00 00 00 | f | (1,3) | {"(1,3)","(3,9)"} + 11 | (16,8292) | 616 | f | f | 2d 00 00 00 00 00 00 00 | f | (6,28) | {"(6,28)","(11,1)"} + 12 | (16,8292) | 616 | f | f | 2e 00 00 00 00 00 00 00 | f | (0,27) | {"(0,27)","(1,13)"} + 13 | (16,8292) | 616 | f | f | 2f 00 00 00 00 00 00 00 | f | (4,17) | {"(4,17)","(4,21)"} +(13 rows) +</pre><p> + This is a B-tree leaf page. All tuples that point to the table + happen to be posting list tuples (all of which store a total of + 100 6 byte TIDs). There is also a <span class="quote">“<span class="quote">high key</span>”</span> tuple + at <code class="literal">itemoffset</code> number 1. + <code class="structfield">ctid</code> is used to store encoded + information about each tuple in this example, though leaf page + tuples often store a heap TID directly in the + <code class="structfield">ctid</code> field instead. + <code class="structfield">tids</code> is the list of TIDs stored as a + posting list. + </p><p> + In an internal page (not shown), the block number part of + <code class="structfield">ctid</code> is a <span class="quote">“<span class="quote">downlink</span>”</span>, + which is a block number of another page in the index itself. + The offset part (the second number) of + <code class="structfield">ctid</code> stores encoded information about + the tuple, such as the number of columns present (suffix + truncation may have removed unneeded suffix columns). Truncated + columns are treated as having the value <span class="quote">“<span class="quote">minus + infinity</span>”</span>. + </p><p> + <code class="structfield">htid</code> shows a heap TID for the tuple, + regardless of the underlying tuple representation. This value + may match <code class="structfield">ctid</code>, or may be decoded + from the alternative representations used by posting list tuples + and tuples from internal pages. Tuples in internal pages + usually have the implementation level heap TID column truncated + away, which is represented as a NULL + <code class="structfield">htid</code> value. + </p><p> + Note that the first item on any non-rightmost page (any page with + a non-zero value in the <code class="structfield">btpo_next</code> field) is the + page's <span class="quote">“<span class="quote">high key</span>”</span>, meaning its <code class="structfield">data</code> + serves as an upper bound on all items appearing on the page, while + its <code class="structfield">ctid</code> field does not point to + another block. Also, on internal pages, the first real data + item (the first item that is not a high key) reliably has every + column truncated away, leaving no actual value in its + <code class="structfield">data</code> field. Such an item does have a + valid downlink in its <code class="structfield">ctid</code> field, + however. + </p><p> + For more details about the structure of B-tree indexes, see + <a class="xref" href="btree-implementation.html#BTREE-STRUCTURE" title="67.4.1. B-Tree Structure">Section 67.4.1</a>. For more details about + deduplication and posting lists, see <a class="xref" href="btree-implementation.html#BTREE-DEDUPLICATION" title="67.4.3. Deduplication">Section 67.4.3</a>. + </p></dd><dt><span class="term"> + <code class="function">bt_page_items(page bytea) returns setof record</code> + <a id="id-1.11.7.35.6.2.5.1.2" class="indexterm"></a> + </span></dt><dd><p> + It is also possible to pass a page to <code class="function">bt_page_items</code> + as a <code class="type">bytea</code> value. A page image obtained + with <code class="function">get_raw_page</code> should be passed as argument. So + the last example could also be rewritten like this: +</p><pre class="screen"> +test=# SELECT itemoffset, ctid, itemlen, nulls, vars, data, dead, htid, tids[0:2] AS some_tids + FROM bt_page_items(get_raw_page('tenk2_hundred', 5)); + itemoffset | ctid | itemlen | nulls | vars | data | dead | htid | some_tids +------------+-----------+---------+-------+------+-------------------------+------+--------+--------------------- + 1 | (16,1) | 16 | f | f | 30 00 00 00 00 00 00 00 | | | + 2 | (16,8292) | 616 | f | f | 24 00 00 00 00 00 00 00 | f | (1,6) | {"(1,6)","(10,22)"} + 3 | (16,8292) | 616 | f | f | 25 00 00 00 00 00 00 00 | f | (1,18) | {"(1,18)","(4,22)"} + 4 | (16,8292) | 616 | f | f | 26 00 00 00 00 00 00 00 | f | (4,18) | {"(4,18)","(6,17)"} + 5 | (16,8292) | 616 | f | f | 27 00 00 00 00 00 00 00 | f | (1,2) | {"(1,2)","(1,19)"} + 6 | (16,8292) | 616 | f | f | 28 00 00 00 00 00 00 00 | f | (2,24) | {"(2,24)","(4,11)"} + 7 | (16,8292) | 616 | f | f | 29 00 00 00 00 00 00 00 | f | (2,17) | {"(2,17)","(11,2)"} + 8 | (16,8292) | 616 | f | f | 2a 00 00 00 00 00 00 00 | f | (0,25) | {"(0,25)","(3,20)"} + 9 | (16,8292) | 616 | f | f | 2b 00 00 00 00 00 00 00 | f | (0,10) | {"(0,10)","(0,14)"} + 10 | (16,8292) | 616 | f | f | 2c 00 00 00 00 00 00 00 | f | (1,3) | {"(1,3)","(3,9)"} + 11 | (16,8292) | 616 | f | f | 2d 00 00 00 00 00 00 00 | f | (6,28) | {"(6,28)","(11,1)"} + 12 | (16,8292) | 616 | f | f | 2e 00 00 00 00 00 00 00 | f | (0,27) | {"(0,27)","(1,13)"} + 13 | (16,8292) | 616 | f | f | 2f 00 00 00 00 00 00 00 | f | (4,17) | {"(4,17)","(4,21)"} +(13 rows) +</pre><p> + All the other details are the same as explained in the previous item. + </p></dd></dl></div></div><div class="sect2" id="PAGEINSPECT-BRIN-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.4. BRIN Functions <a href="#PAGEINSPECT-BRIN-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">brin_page_type(page bytea) returns text</code> + <a id="id-1.11.7.35.7.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">brin_page_type</code> returns the page type of the given + <acronym class="acronym">BRIN</acronym> index page, or throws an error if the page is + not a valid <acronym class="acronym">BRIN</acronym> page. For example: +</p><pre class="screen"> +test=# SELECT brin_page_type(get_raw_page('brinidx', 0)); + brin_page_type +---------------- + meta +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">brin_metapage_info(page bytea) returns record</code> + <a id="id-1.11.7.35.7.2.2.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">brin_metapage_info</code> returns assorted information + about a <acronym class="acronym">BRIN</acronym> index metapage. For example: +</p><pre class="screen"> +test=# SELECT * FROM brin_metapage_info(get_raw_page('brinidx', 0)); + magic | version | pagesperrange | lastrevmappage +------------+---------+---------------+---------------- + 0xA8109CFA | 1 | 4 | 2 +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">brin_revmap_data(page bytea) returns setof tid</code> + <a id="id-1.11.7.35.7.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">brin_revmap_data</code> returns the list of tuple + identifiers in a <acronym class="acronym">BRIN</acronym> index range map page. + For example: +</p><pre class="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) +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">brin_page_items(page bytea, index oid) returns setof record</code> + <a id="id-1.11.7.35.7.2.4.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">brin_page_items</code> returns the data stored in the + <acronym class="acronym">BRIN</acronym> data page. For example: +</p><pre class="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} +</pre><p> + The returned columns correspond to the fields in the + <code class="structname">BrinMemTuple</code> and <code class="structname">BrinValues</code> structs. + See <code class="filename">src/include/access/brin_tuple.h</code> for details. + </p></dd></dl></div></div><div class="sect2" id="PAGEINSPECT-GIN-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.5. GIN Functions <a href="#PAGEINSPECT-GIN-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">gin_metapage_info(page bytea) returns record</code> + <a id="id-1.11.7.35.8.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">gin_metapage_info</code> returns information about + a <acronym class="acronym">GIN</acronym> index metapage. For example: +</p><pre class="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 +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">gin_page_opaque_info(page bytea) returns record</code> + <a id="id-1.11.7.35.8.2.2.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">gin_page_opaque_info</code> returns information about + a <acronym class="acronym">GIN</acronym> index opaque area, like the page type. + For example: +</p><pre class="screen"> +test=# SELECT * FROM gin_page_opaque_info(get_raw_page('gin_index', 2)); + rightlink | maxoff | flags +-----------+--------+------------------------ + 5 | 0 | {data,leaf,compressed} +(1 row) +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">gin_leafpage_items(page bytea) returns setof record</code> + <a id="id-1.11.7.35.8.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">gin_leafpage_items</code> returns information about + the data stored in a <acronym class="acronym">GIN</acronym> leaf page. For example: +</p><pre class="screen"> +test=# SELECT first_tid, nbytes, tids[0:5] AS some_tids + FROM gin_leafpage_items(get_raw_page('gin_test_idx', 2)); + first_tid | nbytes | some_tids +-----------+--------+---------------------------------------------------------- + (8,41) | 244 | {"(8,41)","(8,43)","(8,44)","(8,45)","(8,46)"} + (10,45) | 248 | {"(10,45)","(10,46)","(10,47)","(10,48)","(10,49)"} + (12,52) | 248 | {"(12,52)","(12,53)","(12,54)","(12,55)","(12,56)"} + (14,59) | 320 | {"(14,59)","(14,60)","(14,61)","(14,62)","(14,63)"} + (167,16) | 376 | {"(167,16)","(167,17)","(167,18)","(167,19)","(167,20)"} + (170,30) | 376 | {"(170,30)","(170,31)","(170,32)","(170,33)","(170,34)"} + (173,44) | 197 | {"(173,44)","(173,45)","(173,46)","(173,47)","(173,48)"} +(7 rows) +</pre><p> + </p></dd></dl></div></div><div class="sect2" id="PAGEINSPECT-GIST-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.6. GiST Functions <a href="#PAGEINSPECT-GIST-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">gist_page_opaque_info(page bytea) returns record</code> + <a id="id-1.11.7.35.9.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">gist_page_opaque_info</code> returns information from + a <acronym class="acronym">GiST</acronym> index page's opaque area, such as the NSN, + rightlink and page type. + For example: +</p><pre class="screen"> +test=# SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2)); + lsn | nsn | rightlink | flags +-----+-----+-----------+-------- + 0/1 | 0/0 | 1 | {leaf} +(1 row) +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">gist_page_items(page bytea, index_oid regclass) returns setof record</code> + <a id="id-1.11.7.35.9.2.2.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">gist_page_items</code> returns information about + the data stored in a page of a <acronym class="acronym">GiST</acronym> index. For example: +</p><pre class="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) +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">gist_page_items_bytea(page bytea) returns setof record</code> + <a id="id-1.11.7.35.9.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + Same as <code class="function">gist_page_items</code>, but returns the key data + as a raw <code class="type">bytea</code> blob. Since it does not attempt to decode + the key, it does not need to know which index is involved. For + example: +</p><pre class="screen"> +test=# SELECT * FROM gist_page_items_bytea(get_raw_page('test_gist_idx', 0)); + itemoffset | ctid | itemlen | dead | key_data +------------+-----------+---------+------+------------------------------------------------------------------------------------ + 1 | (1,65535) | 40 | f | \x00000100ffff28000000000000c064400000000000c06440000000000000f03f000000000000f03f + 2 | (2,65535) | 40 | f | \x00000200ffff28000000000000c074400000000000c074400000000000e064400000000000e06440 + 3 | (3,65535) | 40 | f | \x00000300ffff28000000000000207f400000000000207f400000000000d074400000000000d07440 + 4 | (4,65535) | 40 | f | \x00000400ffff28000000000000c084400000000000c084400000000000307f400000000000307f40 + 5 | (5,65535) | 40 | f | \x00000500ffff28000000000000f089400000000000f089400000000000c884400000000000c88440 + 6 | (6,65535) | 40 | f | \x00000600ffff28000000000000208f400000000000208f400000000000f889400000000000f88940 + 7 | (7,65535) | 40 | f | \x00000700ffff28000000000000408f400000000000408f400000000000288f400000000000288f40 +(7 rows) +</pre><p> + </p></dd></dl></div></div><div class="sect2" id="PAGEINSPECT-HASH-FUNCS"><div class="titlepage"><div><div><h3 class="title">F.25.7. Hash Functions <a href="#PAGEINSPECT-HASH-FUNCS" class="id_link">#</a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"> + <code class="function">hash_page_type(page bytea) returns text</code> + <a id="id-1.11.7.35.10.2.1.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">hash_page_type</code> returns page type of + the given <acronym class="acronym">HASH</acronym> index page. For example: +</p><pre class="screen"> +test=# SELECT hash_page_type(get_raw_page('con_hash_index', 0)); + hash_page_type +---------------- + metapage +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">hash_page_stats(page bytea) returns setof record</code> + <a id="id-1.11.7.35.10.2.2.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">hash_page_stats</code> returns information about + a bucket or overflow page of a <acronym class="acronym">HASH</acronym> index. + For example: +</p><pre class="screen"> +test=# SELECT * FROM hash_page_stats(get_raw_page('con_hash_index', 1)); +-[ RECORD 1 ]---+----------- +live_items | 407 +dead_items | 0 +page_size | 8192 +free_size | 8 +hasho_prevblkno | 4096 +hasho_nextblkno | 8474 +hasho_bucket | 0 +hasho_flag | 66 +hasho_page_id | 65408 +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">hash_page_items(page bytea) returns setof record</code> + <a id="id-1.11.7.35.10.2.3.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">hash_page_items</code> returns information about + the data stored in a bucket or overflow page of a <acronym class="acronym">HASH</acronym> + index page. For example: +</p><pre class="screen"> +test=# SELECT * FROM hash_page_items(get_raw_page('con_hash_index', 1)) LIMIT 5; + itemoffset | ctid | data +------------+-----------+------------ + 1 | (899,77) | 1053474816 + 2 | (897,29) | 1053474816 + 3 | (894,207) | 1053474816 + 4 | (892,159) | 1053474816 + 5 | (890,111) | 1053474816 +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">hash_bitmap_info(index oid, blkno bigint) returns record</code> + <a id="id-1.11.7.35.10.2.4.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">hash_bitmap_info</code> shows the status of a bit + in the bitmap page for a particular overflow page of <acronym class="acronym">HASH</acronym> + index. For example: +</p><pre class="screen"> +test=# SELECT * FROM hash_bitmap_info('con_hash_index', 2052); + bitmapblkno | bitmapbit | bitstatus +-------------+-----------+----------- + 65 | 3 | t +</pre><p> + </p></dd><dt><span class="term"> + <code class="function">hash_metapage_info(page bytea) returns record</code> + <a id="id-1.11.7.35.10.2.5.1.2" class="indexterm"></a> + </span></dt><dd><p> + <code class="function">hash_metapage_info</code> returns information stored + in the meta page of a <acronym class="acronym">HASH</acronym> index. For example: +</p><pre class="screen"> +test=# SELECT magic, version, ntuples, ffactor, bsize, bmsize, bmshift, +test-# maxbucket, highmask, lowmask, ovflpoint, firstfree, nmaps, procid, +test-# regexp_replace(spares::text, '(,0)*}', '}') as spares, +test-# regexp_replace(mapp::text, '(,0)*}', '}') as mapp +test-# FROM hash_metapage_info(get_raw_page('con_hash_index', 0)); +-[ RECORD 1 ]------------------------------------------------------------------------------- +magic | 105121344 +version | 4 +ntuples | 500500 +ffactor | 40 +bsize | 8152 +bmsize | 4096 +bmshift | 15 +maxbucket | 12512 +highmask | 16383 +lowmask | 8191 +ovflpoint | 28 +firstfree | 1204 +nmaps | 1 +procid | 450 +spares | {0,0,0,0,0,0,1,1,1,1,1,1,1,1,3,4,4,4,45,55,58,59,508,567,628,704,1193,1202,1204} +mapp | {65} +</pre><p> + </p></dd></dl></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="oldsnapshot.html" title="F.24. old_snapshot — inspect old_snapshot_threshold state">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="passwordcheck.html" title="F.26. passwordcheck — verify password strength">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.24. old_snapshot — inspect <code class="literal">old_snapshot_threshold</code> state </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"> F.26. passwordcheck — verify password strength</td></tr></table></div></body></html>
\ No newline at end of file |