codekingpro/portable-devtools
115k
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>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.3 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>3 The <code class="filename">pageinspect</code> module provides functions that allow you to4 inspect the contents of database pages at a low level, which is useful for5 debugging purposes. All of these functions may be used only by superusers.6 </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">7 <code class="function">get_raw_page(relname text, fork text, blkno bigint) returns bytea</code>8 <a id="id-1.11.7.35.4.2.1.1.2" class="indexterm"></a>9 </span></dt><dd><p>10 <code class="function">get_raw_page</code> reads the specified block of the named11 relation and returns a copy as a <code class="type">bytea</code> value. This allows a12 single time-consistent copy of the block to be obtained.13 <em class="replaceable"><code>fork</code></em> should be <code class="literal">'main'</code> for14 the main data fork, <code class="literal">'fsm'</code> for the15 <a class="link" href="storage-fsm.html" title="73.3. Free Space Map">free space map</a>,16 <code class="literal">'vm'</code> for the17 <a class="link" href="storage-vm.html" title="73.4. Visibility Map">visibility map</a>, or18 <code class="literal">'init'</code> for the initialization fork.19 </p></dd><dt><span class="term">20 <code class="function">get_raw_page(relname text, blkno bigint) returns bytea</code>21 </span></dt><dd><p>22 A shorthand version of <code class="function">get_raw_page</code>, for reading23 from the main fork. Equivalent to24 <code class="literal">get_raw_page(relname, 'main', blkno)</code>25 </p></dd><dt><span class="term">26 <code class="function">page_header(page bytea) returns record</code>27 <a id="id-1.11.7.35.4.2.3.1.2" class="indexterm"></a>28 </span></dt><dd><p>29 <code class="function">page_header</code> shows fields that are common to all30 <span class="productname">PostgreSQL</span> heap and index pages.31 </p><p>32 A page image obtained with <code class="function">get_raw_page</code> should be33 passed as argument. For example:34</p><pre class="screen">35test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));36 lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid37-----------+----------+--------+-------+-------+---------+----------+---------+-----------38 0/24A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 039</pre><p>40 The returned columns correspond to the fields in the41 <code class="structname">PageHeaderData</code> struct.42 See <code class="filename">src/include/storage/bufpage.h</code> for details.43 </p><p>44 The <code class="structfield">checksum</code> field is the checksum stored in45 the page, which might be incorrect if the page is somehow corrupted. If46 data checksums are not enabled for this instance, then the value stored47 is meaningless.48 </p></dd><dt><span class="term">49 <code class="function">page_checksum(page bytea, blkno bigint) returns smallint</code>50 <a id="id-1.11.7.35.4.2.4.1.2" class="indexterm"></a>51 </span></dt><dd><p>52 <code class="function">page_checksum</code> computes the checksum for the page, as if53 it was located at the given block.54 </p><p>55 A page image obtained with <code class="function">get_raw_page</code> should be56 passed as argument. For example:57</p><pre class="screen">58test=# SELECT page_checksum(get_raw_page('pg_class', 0), 0);59 page_checksum60---------------61 1344362</pre><p>63 Note that the checksum depends on the block number, so matching block64 numbers should be passed (except when doing esoteric debugging).65 </p><p>66 The checksum computed with this function can be compared with67 the <code class="structfield">checksum</code> result field of the68 function <code class="function">page_header</code>. If data checksums are69 enabled for this instance, then the two values should be equal.70 </p></dd><dt><span class="term">71 <code class="function">fsm_page_contents(page bytea) returns text</code>72 <a id="id-1.11.7.35.4.2.5.1.2" class="indexterm"></a>73 </span></dt><dd><p>74 <code class="function">fsm_page_contents</code> shows the internal node structure75 of an <acronym class="acronym">FSM</acronym> page. For example:76</p><pre class="screen">77test=# SELECT fsm_page_contents(get_raw_page('pg_class', 'fsm', 0));78</pre><p>79 The output is a multiline string, with one line per node in the binary80 tree within the page. Only those nodes that are not zero are printed.81 The so-called "next" pointer, which points to the next slot to be82 returned from the page, is also printed.83 </p><p>84 See <code class="filename">src/backend/storage/freespace/README</code> for more85 information on the structure of an <acronym class="acronym">FSM</acronym> page.86 </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">87 <code class="function">heap_page_items(page bytea) returns setof record</code>88 <a id="id-1.11.7.35.5.2.1.1.2" class="indexterm"></a>89 </span></dt><dd><p>90 <code class="function">heap_page_items</code> shows all line pointers on a heap91 page. For those line pointers that are in use, tuple headers as well92 as tuple raw data are also shown. All tuples are shown, whether or not93 the tuples were visible to an MVCC snapshot at the time the raw page94 was copied.95 </p><p>96 A heap page image obtained with <code class="function">get_raw_page</code> should97 be passed as argument. For example:98</p><pre class="screen">99test=# SELECT * FROM heap_page_items(get_raw_page('pg_class', 0));100</pre><p>101 See <code class="filename">src/include/storage/itemid.h</code> and102 <code class="filename">src/include/access/htup_details.h</code> for explanations of the fields103 returned.104 </p><p>105 The <code class="function">heap_tuple_infomask_flags</code> function can be106 used to unpack the flag bits of <code class="structfield">t_infomask</code>107 and <code class="structfield">t_infomask2</code> for heap tuples.108 </p></dd><dt><span class="term">109 <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>110 <a id="id-1.11.7.35.5.2.2.1.2" class="indexterm"></a>111 </span></dt><dd><p>112 <code class="function">tuple_data_split</code> splits tuple data into attributes113 in the same way as backend internals.114</p><pre class="screen">115test=# 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));116</pre><p>117 This function should be called with the same arguments as the return118 attributes of <code class="function">heap_page_items</code>.119 </p><p>120 If <em class="parameter"><code>do_detoast</code></em> is <code class="literal">true</code>,121 attributes will be detoasted as needed. Default value is122 <code class="literal">false</code>.123 </p></dd><dt><span class="term">124 <code class="function">heap_page_item_attrs(page bytea, rel_oid regclass [, do_detoast bool]) returns setof record</code>125 <a id="id-1.11.7.35.5.2.3.1.2" class="indexterm"></a>126 </span></dt><dd><p>127 <code class="function">heap_page_item_attrs</code> is equivalent to128 <code class="function">heap_page_items</code> except that it returns129 tuple raw data as an array of attributes that can optionally130 be detoasted by <em class="parameter"><code>do_detoast</code></em> which is131 <code class="literal">false</code> by default.132 </p><p>133 A heap page image obtained with <code class="function">get_raw_page</code> should134 be passed as argument. For example:135</p><pre class="screen">136test=# SELECT * FROM heap_page_item_attrs(get_raw_page('pg_class', 0), 'pg_class'::regclass);137</pre><p>138 </p></dd><dt><span class="term">139 <code class="function">heap_tuple_infomask_flags(t_infomask integer, t_infomask2 integer) returns record</code>140 <a id="id-1.11.7.35.5.2.4.1.2" class="indexterm"></a>141 </span></dt><dd><p>142 <code class="function">heap_tuple_infomask_flags</code> decodes the143 <code class="structfield">t_infomask</code> and144 <code class="structfield">t_infomask2</code> returned by145 <code class="function">heap_page_items</code> into a human-readable146 set of arrays made of flag names, with one column for all147 the flags and one column for combined flags. For example:148</p><pre class="screen">149test=# SELECT t_ctid, raw_flags, combined_flags150 FROM heap_page_items(get_raw_page('pg_class', 0)),151 LATERAL heap_tuple_infomask_flags(t_infomask, t_infomask2)152 WHERE t_infomask IS NOT NULL OR t_infomask2 IS NOT NULL;153</pre><p>154 This function should be called with the same arguments as the return155 attributes of <code class="function">heap_page_items</code>.156 </p><p>157 Combined flags are displayed for source-level macros that take into158 account the value of more than one raw bit, such as159 <code class="literal">HEAP_XMIN_FROZEN</code>.160 </p><p>161 See <code class="filename">src/include/access/htup_details.h</code> for162 explanations of the flag names returned.163 </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">164 <code class="function">bt_metap(relname text) returns record</code>165 <a id="id-1.11.7.35.6.2.1.1.2" class="indexterm"></a>166 </span></dt><dd><p>167 <code class="function">bt_metap</code> returns information about a B-tree168 index's metapage. For example:169</p><pre class="screen">170test=# SELECT * FROM bt_metap('pg_cast_oid_index');171-[ RECORD 1 ]-------------+-------172magic | 340322173version | 4174root | 1175level | 0176fastroot | 1177fastlevel | 0178last_cleanup_num_delpages | 0179last_cleanup_num_tuples | 230180allequalimage | f181</pre><p>182 </p></dd><dt><span class="term">183 <code class="function">bt_page_stats(relname text, blkno bigint) returns record</code>184 <a id="id-1.11.7.35.6.2.2.1.2" class="indexterm"></a>185 </span></dt><dd><p>186 <code class="function">bt_page_stats</code> returns summary information about187 a data page of a B-tree index. For example:188</p><pre class="screen">189test=# SELECT * FROM bt_page_stats('pg_cast_oid_index', 1);190-[ RECORD 1 ]-+-----191blkno | 1192type | l193live_items | 224194dead_items | 0195avg_item_size | 16196page_size | 8192197free_size | 3668198btpo_prev | 0199btpo_next | 0200btpo_level | 0201btpo_flags | 3202</pre><p>203 </p></dd><dt><span class="term">204 <code class="function">bt_multi_page_stats(relname text, blkno bigint, blk_count bigint) returns setof record</code>205 <a id="id-1.11.7.35.6.2.3.1.2" class="indexterm"></a>206 </span></dt><dd><p>207 <code class="function">bt_multi_page_stats</code> returns the same information208 as <code class="function">bt_page_stats</code>, but does so for each page of the209 range of pages beginning at <em class="parameter"><code>blkno</code></em> and extending210 for <em class="parameter"><code>blk_count</code></em> pages.211 If <em class="parameter"><code>blk_count</code></em> is negative, all pages212 from <em class="parameter"><code>blkno</code></em> to the end of the index are reported213 on. For example:214</p><pre class="screen">215test=# SELECT * FROM bt_multi_page_stats('pg_proc_oid_index', 5, 2);216-[ RECORD 1 ]-+-----217blkno | 5218type | l219live_items | 367220dead_items | 0221avg_item_size | 16222page_size | 8192223free_size | 808224btpo_prev | 4225btpo_next | 6226btpo_level | 0227btpo_flags | 1228-[ RECORD 2 ]-+-----229blkno | 6230type | l231live_items | 367232dead_items | 0233avg_item_size | 16234page_size | 8192235free_size | 808236btpo_prev | 5237btpo_next | 7238btpo_level | 0239btpo_flags | 1240</pre><p>241 </p></dd><dt><span class="term">242 <code class="function">bt_page_items(relname text, blkno bigint) returns setof record</code>243 <a id="id-1.11.7.35.6.2.4.1.2" class="indexterm"></a>244 </span></dt><dd><p>245 <code class="function">bt_page_items</code> returns detailed information about246 all of the items on a B-tree index page. For example:247</p><pre class="screen">248test=# SELECT itemoffset, ctid, itemlen, nulls, vars, data, dead, htid, tids[0:2] AS some_tids249 FROM bt_page_items('tenk2_hundred', 5);250 itemoffset | ctid | itemlen | nulls | vars | data | dead | htid | some_tids251------------+-----------+---------+-------+------+-------------------------+------+--------+---------------------252 1 | (16,1) | 16 | f | f | 30 00 00 00 00 00 00 00 | | |253 2 | (16,8292) | 616 | f | f | 24 00 00 00 00 00 00 00 | f | (1,6) | {"(1,6)","(10,22)"}254 3 | (16,8292) | 616 | f | f | 25 00 00 00 00 00 00 00 | f | (1,18) | {"(1,18)","(4,22)"}255 4 | (16,8292) | 616 | f | f | 26 00 00 00 00 00 00 00 | f | (4,18) | {"(4,18)","(6,17)"}256 5 | (16,8292) | 616 | f | f | 27 00 00 00 00 00 00 00 | f | (1,2) | {"(1,2)","(1,19)"}257 6 | (16,8292) | 616 | f | f | 28 00 00 00 00 00 00 00 | f | (2,24) | {"(2,24)","(4,11)"}258 7 | (16,8292) | 616 | f | f | 29 00 00 00 00 00 00 00 | f | (2,17) | {"(2,17)","(11,2)"}259 8 | (16,8292) | 616 | f | f | 2a 00 00 00 00 00 00 00 | f | (0,25) | {"(0,25)","(3,20)"}260 9 | (16,8292) | 616 | f | f | 2b 00 00 00 00 00 00 00 | f | (0,10) | {"(0,10)","(0,14)"}261 10 | (16,8292) | 616 | f | f | 2c 00 00 00 00 00 00 00 | f | (1,3) | {"(1,3)","(3,9)"}262 11 | (16,8292) | 616 | f | f | 2d 00 00 00 00 00 00 00 | f | (6,28) | {"(6,28)","(11,1)"}263 12 | (16,8292) | 616 | f | f | 2e 00 00 00 00 00 00 00 | f | (0,27) | {"(0,27)","(1,13)"}264 13 | (16,8292) | 616 | f | f | 2f 00 00 00 00 00 00 00 | f | (4,17) | {"(4,17)","(4,21)"}265(13 rows)266</pre><p>267 This is a B-tree leaf page. All tuples that point to the table268 happen to be posting list tuples (all of which store a total of269 100 6 byte TIDs). There is also a <span class="quote">“<span class="quote">high key</span>”</span> tuple270 at <code class="literal">itemoffset</code> number 1.271 <code class="structfield">ctid</code> is used to store encoded272 information about each tuple in this example, though leaf page273 tuples often store a heap TID directly in the274 <code class="structfield">ctid</code> field instead.275 <code class="structfield">tids</code> is the list of TIDs stored as a276 posting list.277 </p><p>278 In an internal page (not shown), the block number part of279 <code class="structfield">ctid</code> is a <span class="quote">“<span class="quote">downlink</span>”</span>,280 which is a block number of another page in the index itself.281 The offset part (the second number) of282 <code class="structfield">ctid</code> stores encoded information about283 the tuple, such as the number of columns present (suffix284 truncation may have removed unneeded suffix columns). Truncated285 columns are treated as having the value <span class="quote">“<span class="quote">minus286 infinity</span>”</span>.287 </p><p>288 <code class="structfield">htid</code> shows a heap TID for the tuple,289 regardless of the underlying tuple representation. This value290 may match <code class="structfield">ctid</code>, or may be decoded291 from the alternative representations used by posting list tuples292 and tuples from internal pages. Tuples in internal pages293 usually have the implementation level heap TID column truncated294 away, which is represented as a NULL295 <code class="structfield">htid</code> value.296 </p><p>297 Note that the first item on any non-rightmost page (any page with298 a non-zero value in the <code class="structfield">btpo_next</code> field) is the299 page's <span class="quote">“<span class="quote">high key</span>”</span>, meaning its <code class="structfield">data</code>300 serves as an upper bound on all items appearing on the page, while301 its <code class="structfield">ctid</code> field does not point to302 another block. Also, on internal pages, the first real data303 item (the first item that is not a high key) reliably has every304 column truncated away, leaving no actual value in its305 <code class="structfield">data</code> field. Such an item does have a306 valid downlink in its <code class="structfield">ctid</code> field,307 however.308 </p><p>309 For more details about the structure of B-tree indexes, see310 <a class="xref" href="btree-implementation.html#BTREE-STRUCTURE" title="67.4.1. B-Tree Structure">Section 67.4.1</a>. For more details about311 deduplication and posting lists, see <a class="xref" href="btree-implementation.html#BTREE-DEDUPLICATION" title="67.4.3. Deduplication">Section 67.4.3</a>.312 </p></dd><dt><span class="term">313 <code class="function">bt_page_items(page bytea) returns setof record</code>314 <a id="id-1.11.7.35.6.2.5.1.2" class="indexterm"></a>315 </span></dt><dd><p>316 It is also possible to pass a page to <code class="function">bt_page_items</code>317 as a <code class="type">bytea</code> value. A page image obtained318 with <code class="function">get_raw_page</code> should be passed as argument. So319 the last example could also be rewritten like this:320</p><pre class="screen">321test=# SELECT itemoffset, ctid, itemlen, nulls, vars, data, dead, htid, tids[0:2] AS some_tids322 FROM bt_page_items(get_raw_page('tenk2_hundred', 5));323 itemoffset | ctid | itemlen | nulls | vars | data | dead | htid | some_tids324------------+-----------+---------+-------+------+-------------------------+------+--------+---------------------325 1 | (16,1) | 16 | f | f | 30 00 00 00 00 00 00 00 | | |326 2 | (16,8292) | 616 | f | f | 24 00 00 00 00 00 00 00 | f | (1,6) | {"(1,6)","(10,22)"}327 3 | (16,8292) | 616 | f | f | 25 00 00 00 00 00 00 00 | f | (1,18) | {"(1,18)","(4,22)"}328 4 | (16,8292) | 616 | f | f | 26 00 00 00 00 00 00 00 | f | (4,18) | {"(4,18)","(6,17)"}329 5 | (16,8292) | 616 | f | f | 27 00 00 00 00 00 00 00 | f | (1,2) | {"(1,2)","(1,19)"}330 6 | (16,8292) | 616 | f | f | 28 00 00 00 00 00 00 00 | f | (2,24) | {"(2,24)","(4,11)"}331 7 | (16,8292) | 616 | f | f | 29 00 00 00 00 00 00 00 | f | (2,17) | {"(2,17)","(11,2)"}332 8 | (16,8292) | 616 | f | f | 2a 00 00 00 00 00 00 00 | f | (0,25) | {"(0,25)","(3,20)"}333 9 | (16,8292) | 616 | f | f | 2b 00 00 00 00 00 00 00 | f | (0,10) | {"(0,10)","(0,14)"}334 10 | (16,8292) | 616 | f | f | 2c 00 00 00 00 00 00 00 | f | (1,3) | {"(1,3)","(3,9)"}335 11 | (16,8292) | 616 | f | f | 2d 00 00 00 00 00 00 00 | f | (6,28) | {"(6,28)","(11,1)"}336 12 | (16,8292) | 616 | f | f | 2e 00 00 00 00 00 00 00 | f | (0,27) | {"(0,27)","(1,13)"}337 13 | (16,8292) | 616 | f | f | 2f 00 00 00 00 00 00 00 | f | (4,17) | {"(4,17)","(4,21)"}338(13 rows)339</pre><p>340 All the other details are the same as explained in the previous item.341 </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">342 <code class="function">brin_page_type(page bytea) returns text</code>343 <a id="id-1.11.7.35.7.2.1.1.2" class="indexterm"></a>344 </span></dt><dd><p>345 <code class="function">brin_page_type</code> returns the page type of the given346 <acronym class="acronym">BRIN</acronym> index page, or throws an error if the page is347 not a valid <acronym class="acronym">BRIN</acronym> page. For example:348</p><pre class="screen">349test=# SELECT brin_page_type(get_raw_page('brinidx', 0));350 brin_page_type351----------------352 meta353</pre><p>354 </p></dd><dt><span class="term">355 <code class="function">brin_metapage_info(page bytea) returns record</code>356 <a id="id-1.11.7.35.7.2.2.1.2" class="indexterm"></a>357 </span></dt><dd><p>358 <code class="function">brin_metapage_info</code> returns assorted information359 about a <acronym class="acronym">BRIN</acronym> index metapage. For example:360</p><pre class="screen">361test=# SELECT * FROM brin_metapage_info(get_raw_page('brinidx', 0));362 magic | version | pagesperrange | lastrevmappage363------------+---------+---------------+----------------364 0xA8109CFA | 1 | 4 | 2365</pre><p>366 </p></dd><dt><span class="term">367 <code class="function">brin_revmap_data(page bytea) returns setof tid</code>368 <a id="id-1.11.7.35.7.2.3.1.2" class="indexterm"></a>369 </span></dt><dd><p>370 <code class="function">brin_revmap_data</code> returns the list of tuple371 identifiers in a <acronym class="acronym">BRIN</acronym> index range map page.372 For example:373</p><pre class="screen">374test=# SELECT * FROM brin_revmap_data(get_raw_page('brinidx', 2)) LIMIT 5;375 pages376---------377 (6,137)378 (6,138)379 (6,139)380 (6,140)381 (6,141)382</pre><p>383 </p></dd><dt><span class="term">384 <code class="function">brin_page_items(page bytea, index oid) returns setof record</code>385 <a id="id-1.11.7.35.7.2.4.1.2" class="indexterm"></a>386 </span></dt><dd><p>387 <code class="function">brin_page_items</code> returns the data stored in the388 <acronym class="acronym">BRIN</acronym> data page. For example:389</p><pre class="screen">390test=# SELECT * FROM brin_page_items(get_raw_page('brinidx', 5),391 'brinidx')392 ORDER BY blknum, attnum LIMIT 6;393 itemoffset | blknum | attnum | allnulls | hasnulls | placeholder | empty | value394------------+--------+--------+----------+----------+-------------+-------+--------------395 137 | 0 | 1 | t | f | f | f |396 137 | 0 | 2 | f | f | f | f | {1 .. 88}397 138 | 4 | 1 | t | f | f | f |398 138 | 4 | 2 | f | f | f | f | {89 .. 176}399 139 | 8 | 1 | t | f | f | f |400 139 | 8 | 2 | f | f | f | f | {177 .. 264}401</pre><p>402 The returned columns correspond to the fields in the403 <code class="structname">BrinMemTuple</code> and <code class="structname">BrinValues</code> structs.404 See <code class="filename">src/include/access/brin_tuple.h</code> for details.405 </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">406 <code class="function">gin_metapage_info(page bytea) returns record</code>407 <a id="id-1.11.7.35.8.2.1.1.2" class="indexterm"></a>408 </span></dt><dd><p>409 <code class="function">gin_metapage_info</code> returns information about410 a <acronym class="acronym">GIN</acronym> index metapage. For example:411</p><pre class="screen">412test=# SELECT * FROM gin_metapage_info(get_raw_page('gin_index', 0));413-[ RECORD 1 ]----+-----------414pending_head | 4294967295415pending_tail | 4294967295416tail_free_size | 0417n_pending_pages | 0418n_pending_tuples | 0419n_total_pages | 7420n_entry_pages | 6421n_data_pages | 0422n_entries | 693423version | 2424</pre><p>425 </p></dd><dt><span class="term">426 <code class="function">gin_page_opaque_info(page bytea) returns record</code>427 <a id="id-1.11.7.35.8.2.2.1.2" class="indexterm"></a>428 </span></dt><dd><p>429 <code class="function">gin_page_opaque_info</code> returns information about430 a <acronym class="acronym">GIN</acronym> index opaque area, like the page type.431 For example:432</p><pre class="screen">433test=# SELECT * FROM gin_page_opaque_info(get_raw_page('gin_index', 2));434 rightlink | maxoff | flags435-----------+--------+------------------------436 5 | 0 | {data,leaf,compressed}437(1 row)438</pre><p>439 </p></dd><dt><span class="term">440 <code class="function">gin_leafpage_items(page bytea) returns setof record</code>441 <a id="id-1.11.7.35.8.2.3.1.2" class="indexterm"></a>442 </span></dt><dd><p>443 <code class="function">gin_leafpage_items</code> returns information about444 the data stored in a <acronym class="acronym">GIN</acronym> leaf page. For example:445</p><pre class="screen">446test=# SELECT first_tid, nbytes, tids[0:5] AS some_tids447 FROM gin_leafpage_items(get_raw_page('gin_test_idx', 2));448 first_tid | nbytes | some_tids449-----------+--------+----------------------------------------------------------450 (8,41) | 244 | {"(8,41)","(8,43)","(8,44)","(8,45)","(8,46)"}451 (10,45) | 248 | {"(10,45)","(10,46)","(10,47)","(10,48)","(10,49)"}452 (12,52) | 248 | {"(12,52)","(12,53)","(12,54)","(12,55)","(12,56)"}453 (14,59) | 320 | {"(14,59)","(14,60)","(14,61)","(14,62)","(14,63)"}454 (167,16) | 376 | {"(167,16)","(167,17)","(167,18)","(167,19)","(167,20)"}455 (170,30) | 376 | {"(170,30)","(170,31)","(170,32)","(170,33)","(170,34)"}456 (173,44) | 197 | {"(173,44)","(173,45)","(173,46)","(173,47)","(173,48)"}457(7 rows)458</pre><p>459 </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">460 <code class="function">gist_page_opaque_info(page bytea) returns record</code>461 <a id="id-1.11.7.35.9.2.1.1.2" class="indexterm"></a>462 </span></dt><dd><p>463 <code class="function">gist_page_opaque_info</code> returns information from464 a <acronym class="acronym">GiST</acronym> index page's opaque area, such as the NSN,465 rightlink and page type.466 For example:467</p><pre class="screen">468test=# SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));469 lsn | nsn | rightlink | flags470-----+-----+-----------+--------471 0/1 | 0/0 | 1 | {leaf}472(1 row)473</pre><p>474 </p></dd><dt><span class="term">475 <code class="function">gist_page_items(page bytea, index_oid regclass) returns setof record</code>476 <a id="id-1.11.7.35.9.2.2.1.2" class="indexterm"></a>477 </span></dt><dd><p>478 <code class="function">gist_page_items</code> returns information about479 the data stored in a page of a <acronym class="acronym">GiST</acronym> index. For example:480</p><pre class="screen">481test=# SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx');482 itemoffset | ctid | itemlen | dead | keys483------------+-----------+---------+------+-------------------------------484 1 | (1,65535) | 40 | f | (p)=("(185,185),(1,1)")485 2 | (2,65535) | 40 | f | (p)=("(370,370),(186,186)")486 3 | (3,65535) | 40 | f | (p)=("(555,555),(371,371)")487 4 | (4,65535) | 40 | f | (p)=("(740,740),(556,556)")488 5 | (5,65535) | 40 | f | (p)=("(870,870),(741,741)")489 6 | (6,65535) | 40 | f | (p)=("(1000,1000),(871,871)")490(6 rows)491</pre><p>492 </p></dd><dt><span class="term">493 <code class="function">gist_page_items_bytea(page bytea) returns setof record</code>494 <a id="id-1.11.7.35.9.2.3.1.2" class="indexterm"></a>495 </span></dt><dd><p>496 Same as <code class="function">gist_page_items</code>, but returns the key data497 as a raw <code class="type">bytea</code> blob. Since it does not attempt to decode498 the key, it does not need to know which index is involved. For499 example:500</p><pre class="screen">501test=# SELECT * FROM gist_page_items_bytea(get_raw_page('test_gist_idx', 0));502 itemoffset | ctid | itemlen | dead | key_data503------------+-----------+---------+------+------------------------------------------------------------------------------------504 1 | (1,65535) | 40 | f | \x00000100ffff28000000000000c064400000000000c06440000000000000f03f000000000000f03f505 2 | (2,65535) | 40 | f | \x00000200ffff28000000000000c074400000000000c074400000000000e064400000000000e06440506 3 | (3,65535) | 40 | f | \x00000300ffff28000000000000207f400000000000207f400000000000d074400000000000d07440507 4 | (4,65535) | 40 | f | \x00000400ffff28000000000000c084400000000000c084400000000000307f400000000000307f40508 5 | (5,65535) | 40 | f | \x00000500ffff28000000000000f089400000000000f089400000000000c884400000000000c88440509 6 | (6,65535) | 40 | f | \x00000600ffff28000000000000208f400000000000208f400000000000f889400000000000f88940510 7 | (7,65535) | 40 | f | \x00000700ffff28000000000000408f400000000000408f400000000000288f400000000000288f40511(7 rows)512</pre><p>513 </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">514 <code class="function">hash_page_type(page bytea) returns text</code>515 <a id="id-1.11.7.35.10.2.1.1.2" class="indexterm"></a>516 </span></dt><dd><p>517 <code class="function">hash_page_type</code> returns page type of518 the given <acronym class="acronym">HASH</acronym> index page. For example:519</p><pre class="screen">520test=# SELECT hash_page_type(get_raw_page('con_hash_index', 0));521 hash_page_type522----------------523 metapage524</pre><p>525 </p></dd><dt><span class="term">526 <code class="function">hash_page_stats(page bytea) returns setof record</code>527 <a id="id-1.11.7.35.10.2.2.1.2" class="indexterm"></a>528 </span></dt><dd><p>529 <code class="function">hash_page_stats</code> returns information about530 a bucket or overflow page of a <acronym class="acronym">HASH</acronym> index.531 For example:532</p><pre class="screen">533test=# SELECT * FROM hash_page_stats(get_raw_page('con_hash_index', 1));534-[ RECORD 1 ]---+-----------535live_items | 407536dead_items | 0537page_size | 8192538free_size | 8539hasho_prevblkno | 4096540hasho_nextblkno | 8474541hasho_bucket | 0542hasho_flag | 66543hasho_page_id | 65408544</pre><p>545 </p></dd><dt><span class="term">546 <code class="function">hash_page_items(page bytea) returns setof record</code>547 <a id="id-1.11.7.35.10.2.3.1.2" class="indexterm"></a>548 </span></dt><dd><p>549 <code class="function">hash_page_items</code> returns information about550 the data stored in a bucket or overflow page of a <acronym class="acronym">HASH</acronym>551 index page. For example:552</p><pre class="screen">553test=# SELECT * FROM hash_page_items(get_raw_page('con_hash_index', 1)) LIMIT 5;554 itemoffset | ctid | data555------------+-----------+------------556 1 | (899,77) | 1053474816557 2 | (897,29) | 1053474816558 3 | (894,207) | 1053474816559 4 | (892,159) | 1053474816560 5 | (890,111) | 1053474816561</pre><p>562 </p></dd><dt><span class="term">563 <code class="function">hash_bitmap_info(index oid, blkno bigint) returns record</code>564 <a id="id-1.11.7.35.10.2.4.1.2" class="indexterm"></a>565 </span></dt><dd><p>566 <code class="function">hash_bitmap_info</code> shows the status of a bit567 in the bitmap page for a particular overflow page of <acronym class="acronym">HASH</acronym>568 index. For example:569</p><pre class="screen">570test=# SELECT * FROM hash_bitmap_info('con_hash_index', 2052);571 bitmapblkno | bitmapbit | bitstatus572-------------+-----------+-----------573 65 | 3 | t574</pre><p>575 </p></dd><dt><span class="term">576 <code class="function">hash_metapage_info(page bytea) returns record</code>577 <a id="id-1.11.7.35.10.2.5.1.2" class="indexterm"></a>578 </span></dt><dd><p>579 <code class="function">hash_metapage_info</code> returns information stored580 in the meta page of a <acronym class="acronym">HASH</acronym> index. For example:581</p><pre class="screen">582test=# SELECT magic, version, ntuples, ffactor, bsize, bmsize, bmshift,583test-# maxbucket, highmask, lowmask, ovflpoint, firstfree, nmaps, procid,584test-# regexp_replace(spares::text, '(,0)*}', '}') as spares,585test-# regexp_replace(mapp::text, '(,0)*}', '}') as mapp586test-# FROM hash_metapage_info(get_raw_page('con_hash_index', 0));587-[ RECORD 1 ]-------------------------------------------------------------------------------588magic | 105121344589version | 4590ntuples | 500500591ffactor | 40592bsize | 8152593bmsize | 4096594bmshift | 15595maxbucket | 12512596highmask | 16383597lowmask | 8191598ovflpoint | 28599firstfree | 1204600nmaps | 1601procid | 450602spares | {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}603mapp | {65}604</pre><p>605 </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.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.26. passwordcheck — verify password strength</td></tr></table></div></body></html>