gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

436 lines
25KB

  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.22. pageinspect</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="ltree.html" title="F.21. ltree" /><link rel="next" href="passwordcheck.html" title="F.23. passwordcheck" /></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">F.22. pageinspect</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="ltree.html" title="F.21. ltree">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</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="passwordcheck.html" title="F.23. passwordcheck">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="PAGEINSPECT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.22. pageinspect</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="pageinspect.html#id-1.11.7.31.4">F.22.1. General Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#id-1.11.7.31.5">F.22.2. Heap Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#id-1.11.7.31.6">F.22.3. B-Tree Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#id-1.11.7.31.7">F.22.4. BRIN Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#id-1.11.7.31.8">F.22.5. GIN Functions</a></span></dt><dt><span class="sect2"><a href="pageinspect.html#id-1.11.7.31.9">F.22.6. Hash Functions</a></span></dt></dl></div><a id="id-1.11.7.31.2" class="indexterm"></a><p>
  3. The <code class="filename">pageinspect</code> module provides functions that allow you to
  4. inspect the contents of database pages at a low level, which is useful for
  5. debugging purposes. All of these functions may be used only by superusers.
  6. </p><div class="sect2" id="id-1.11.7.31.4"><div class="titlepage"><div><div><h3 class="title">F.22.1. General Functions</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 int) returns bytea</code>
  8. <a id="id-1.11.7.31.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 named
  11. relation and returns a copy as a <code class="type">bytea</code> value. This allows a
  12. 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> for
  14. the main data fork, <code class="literal">'fsm'</code> for the free space map,
  15. <code class="literal">'vm'</code> for the visibility map, or <code class="literal">'init'</code>
  16. for the initialization fork.
  17. </p></dd><dt><span class="term">
  18. <code class="function">get_raw_page(relname text, blkno int) returns bytea</code>
  19. </span></dt><dd><p>
  20. A shorthand version of <code class="function">get_raw_page</code>, for reading
  21. from the main fork. Equivalent to
  22. <code class="literal">get_raw_page(relname, 'main', blkno)</code>
  23. </p></dd><dt><span class="term">
  24. <code class="function">page_header(page bytea) returns record</code>
  25. <a id="id-1.11.7.31.4.2.3.1.2" class="indexterm"></a>
  26. </span></dt><dd><p>
  27. <code class="function">page_header</code> shows fields that are common to all
  28. <span class="productname">PostgreSQL</span> heap and index pages.
  29. </p><p>
  30. A page image obtained with <code class="function">get_raw_page</code> should be
  31. passed as argument. For example:
  32. </p><pre class="screen">
  33. test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
  34. lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
  35. -----------+----------+--------+-------+-------+---------+----------+---------+-----------
  36. 0/24A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
  37. </pre><p>
  38. The returned columns correspond to the fields in the
  39. <code class="structname">PageHeaderData</code> struct.
  40. See <code class="filename">src/include/storage/bufpage.h</code> for details.
  41. </p><p>
  42. The <code class="structfield">checksum</code> field is the checksum stored in
  43. the page, which might be incorrect if the page is somehow corrupted. If
  44. data checksums are not enabled for this instance, then the value stored
  45. is meaningless.
  46. </p></dd><dt><span class="term">
  47. <code class="function">page_checksum(page bytea, blkno int4) returns smallint</code>
  48. <a id="id-1.11.7.31.4.2.4.1.2" class="indexterm"></a>
  49. </span></dt><dd><p>
  50. <code class="function">page_checksum</code> computes the checksum for the page, as if
  51. it was located at the given block.
  52. </p><p>
  53. A page image obtained with <code class="function">get_raw_page</code> should be
  54. passed as argument. For example:
  55. </p><pre class="screen">
  56. test=# SELECT page_checksum(get_raw_page('pg_class', 0), 0);
  57. page_checksum
  58. ---------------
  59. 13443
  60. </pre><p>
  61. Note that the checksum depends on the block number, so matching block
  62. numbers should be passed (except when doing esoteric debugging).
  63. </p><p>
  64. The checksum computed with this function can be compared with
  65. the <code class="structfield">checksum</code> result field of the
  66. function <code class="function">page_header</code>. If data checksums are
  67. enabled for this instance, then the two values should be equal.
  68. </p></dd><dt><span class="term">
  69. <code class="function">fsm_page_contents(page bytea) returns text</code>
  70. <a id="id-1.11.7.31.4.2.5.1.2" class="indexterm"></a>
  71. </span></dt><dd><p>
  72. <code class="function">fsm_page_contents</code> shows the internal node structure
  73. of a FSM page. For example:
  74. </p><pre class="screen">
  75. test=# SELECT fsm_page_contents(get_raw_page('pg_class', 'fsm', 0));
  76. </pre><p>
  77. The output is a multiline string, with one line per node in the binary
  78. tree within the page. Only those nodes that are not zero are printed.
  79. The so-called "next" pointer, which points to the next slot to be
  80. returned from the page, is also printed.
  81. </p><p>
  82. See <code class="filename">src/backend/storage/freespace/README</code> for more
  83. information on the structure of an FSM page.
  84. </p></dd></dl></div></div><div class="sect2" id="id-1.11.7.31.5"><div class="titlepage"><div><div><h3 class="title">F.22.2. Heap Functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  85. <code class="function">heap_page_items(page bytea) returns setof record</code>
  86. <a id="id-1.11.7.31.5.2.1.1.2" class="indexterm"></a>
  87. </span></dt><dd><p>
  88. <code class="function">heap_page_items</code> shows all line pointers on a heap
  89. page. For those line pointers that are in use, tuple headers as well
  90. as tuple raw data are also shown. All tuples are shown, whether or not
  91. the tuples were visible to an MVCC snapshot at the time the raw page
  92. was copied.
  93. </p><p>
  94. A heap page image obtained with <code class="function">get_raw_page</code> should
  95. be passed as argument. For example:
  96. </p><pre class="screen">
  97. test=# SELECT * FROM heap_page_items(get_raw_page('pg_class', 0));
  98. </pre><p>
  99. See <code class="filename">src/include/storage/itemid.h</code> and
  100. <code class="filename">src/include/access/htup_details.h</code> for explanations of the fields
  101. returned.
  102. </p></dd><dt><span class="term">
  103. <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>
  104. <a id="id-1.11.7.31.5.2.2.1.2" class="indexterm"></a>
  105. </span></dt><dd><p>
  106. <code class="function">tuple_data_split</code> splits tuple data into attributes
  107. in the same way as backend internals.
  108. </p><pre class="screen">
  109. 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));
  110. </pre><p>
  111. This function should be called with the same arguments as the return
  112. attributes of <code class="function">heap_page_items</code>.
  113. </p><p>
  114. If <em class="parameter"><code>do_detoast</code></em> is <code class="literal">true</code>,
  115. attribute that will be detoasted as needed. Default value is
  116. <code class="literal">false</code>.
  117. </p></dd><dt><span class="term">
  118. <code class="function">heap_page_item_attrs(page bytea, rel_oid regclass [, do_detoast bool]) returns setof record</code>
  119. <a id="id-1.11.7.31.5.2.3.1.2" class="indexterm"></a>
  120. </span></dt><dd><p>
  121. <code class="function">heap_page_item_attrs</code> is equivalent to
  122. <code class="function">heap_page_items</code> except that it returns
  123. tuple raw data as an array of attributes that can optionally
  124. be detoasted by <em class="parameter"><code>do_detoast</code></em> which is
  125. <code class="literal">false</code> by default.
  126. </p><p>
  127. A heap page image obtained with <code class="function">get_raw_page</code> should
  128. be passed as argument. For example:
  129. </p><pre class="screen">
  130. test=# SELECT * FROM heap_page_item_attrs(get_raw_page('pg_class', 0), 'pg_class'::regclass);
  131. </pre><p>
  132. </p></dd></dl></div></div><div class="sect2" id="id-1.11.7.31.6"><div class="titlepage"><div><div><h3 class="title">F.22.3. B-Tree Functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  133. <code class="function">bt_metap(relname text) returns record</code>
  134. <a id="id-1.11.7.31.6.2.1.1.2" class="indexterm"></a>
  135. </span></dt><dd><p>
  136. <code class="function">bt_metap</code> returns information about a B-tree
  137. index's metapage. For example:
  138. </p><pre class="screen">
  139. test=# SELECT * FROM bt_metap('pg_cast_oid_index');
  140. -[ RECORD 1 ]-----------+-------
  141. magic | 340322
  142. version | 3
  143. root | 1
  144. level | 0
  145. fastroot | 1
  146. fastlevel | 0
  147. oldest_xact | 582
  148. last_cleanup_num_tuples | 1000
  149. </pre><p>
  150. </p></dd><dt><span class="term">
  151. <code class="function">bt_page_stats(relname text, blkno int) returns record</code>
  152. <a id="id-1.11.7.31.6.2.2.1.2" class="indexterm"></a>
  153. </span></dt><dd><p>
  154. <code class="function">bt_page_stats</code> returns summary information about
  155. single pages of B-tree indexes. For example:
  156. </p><pre class="screen">
  157. test=# SELECT * FROM bt_page_stats('pg_cast_oid_index', 1);
  158. -[ RECORD 1 ]-+-----
  159. blkno | 1
  160. type | l
  161. live_items | 256
  162. dead_items | 0
  163. avg_item_size | 12
  164. page_size | 8192
  165. free_size | 4056
  166. btpo_prev | 0
  167. btpo_next | 0
  168. btpo | 0
  169. btpo_flags | 3
  170. </pre><p>
  171. </p></dd><dt><span class="term">
  172. <code class="function">bt_page_items(relname text, blkno int) returns setof record</code>
  173. <a id="id-1.11.7.31.6.2.3.1.2" class="indexterm"></a>
  174. </span></dt><dd><p>
  175. <code class="function">bt_page_items</code> returns detailed information about
  176. all of the items on a B-tree index page. For example:
  177. </p><pre class="screen">
  178. test=# SELECT * FROM bt_page_items('pg_cast_oid_index', 1);
  179. itemoffset | ctid | itemlen | nulls | vars | data
  180. ------------+---------+---------+-------+------+-------------
  181. 1 | (0,1) | 12 | f | f | 23 27 00 00
  182. 2 | (0,2) | 12 | f | f | 24 27 00 00
  183. 3 | (0,3) | 12 | f | f | 25 27 00 00
  184. 4 | (0,4) | 12 | f | f | 26 27 00 00
  185. 5 | (0,5) | 12 | f | f | 27 27 00 00
  186. 6 | (0,6) | 12 | f | f | 28 27 00 00
  187. 7 | (0,7) | 12 | f | f | 29 27 00 00
  188. 8 | (0,8) | 12 | f | f | 2a 27 00 00
  189. </pre><p>
  190. In a B-tree leaf page, <code class="structfield">ctid</code> points to a heap tuple.
  191. In an internal page, the block number part of <code class="structfield">ctid</code>
  192. points to another page in the index itself, while the offset part
  193. (the second number) is ignored and is usually 1.
  194. </p><p>
  195. Note that the first item on any non-rightmost page (any page with
  196. a non-zero value in the <code class="structfield">btpo_next</code> field) is the
  197. page's <span class="quote">“<span class="quote">high key</span>”</span>, meaning its <code class="structfield">data</code>
  198. serves as an upper bound on all items appearing on the page, while
  199. its <code class="structfield">ctid</code> field is meaningless. Also, on non-leaf
  200. pages, the first real data item (the first item that is not a high
  201. key) is a <span class="quote">“<span class="quote">minus infinity</span>”</span> item, with no actual value
  202. in its <code class="structfield">data</code> field. Such an item does have a valid
  203. downlink in its <code class="structfield">ctid</code> field, however.
  204. </p></dd><dt><span class="term">
  205. <code class="function">bt_page_items(page bytea) returns setof record</code>
  206. <a id="id-1.11.7.31.6.2.4.1.2" class="indexterm"></a>
  207. </span></dt><dd><p>
  208. It is also possible to pass a page to <code class="function">bt_page_items</code>
  209. as a <code class="type">bytea</code> value. A page image obtained
  210. with <code class="function">get_raw_page</code> should be passed as argument. So
  211. the last example could also be rewritten like this:
  212. </p><pre class="screen">
  213. test=# SELECT * FROM bt_page_items(get_raw_page('pg_cast_oid_index', 1));
  214. itemoffset | ctid | itemlen | nulls | vars | data
  215. ------------+---------+---------+-------+------+-------------
  216. 1 | (0,1) | 12 | f | f | 23 27 00 00
  217. 2 | (0,2) | 12 | f | f | 24 27 00 00
  218. 3 | (0,3) | 12 | f | f | 25 27 00 00
  219. 4 | (0,4) | 12 | f | f | 26 27 00 00
  220. 5 | (0,5) | 12 | f | f | 27 27 00 00
  221. 6 | (0,6) | 12 | f | f | 28 27 00 00
  222. 7 | (0,7) | 12 | f | f | 29 27 00 00
  223. 8 | (0,8) | 12 | f | f | 2a 27 00 00
  224. </pre><p>
  225. All the other details are the same as explained in the previous item.
  226. </p></dd></dl></div></div><div class="sect2" id="id-1.11.7.31.7"><div class="titlepage"><div><div><h3 class="title">F.22.4. BRIN Functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  227. <code class="function">brin_page_type(page bytea) returns text</code>
  228. <a id="id-1.11.7.31.7.2.1.1.2" class="indexterm"></a>
  229. </span></dt><dd><p>
  230. <code class="function">brin_page_type</code> returns the page type of the given
  231. <acronym class="acronym">BRIN</acronym> index page, or throws an error if the page is
  232. not a valid <acronym class="acronym">BRIN</acronym> page. For example:
  233. </p><pre class="screen">
  234. test=# SELECT brin_page_type(get_raw_page('brinidx', 0));
  235. brin_page_type
  236. ----------------
  237. meta
  238. </pre><p>
  239. </p></dd><dt><span class="term">
  240. <code class="function">brin_metapage_info(page bytea) returns record</code>
  241. <a id="id-1.11.7.31.7.2.2.1.2" class="indexterm"></a>
  242. </span></dt><dd><p>
  243. <code class="function">brin_metapage_info</code> returns assorted information
  244. about a <acronym class="acronym">BRIN</acronym> index metapage. For example:
  245. </p><pre class="screen">
  246. test=# SELECT * FROM brin_metapage_info(get_raw_page('brinidx', 0));
  247. magic | version | pagesperrange | lastrevmappage
  248. ------------+---------+---------------+----------------
  249. 0xA8109CFA | 1 | 4 | 2
  250. </pre><p>
  251. </p></dd><dt><span class="term">
  252. <code class="function">brin_revmap_data(page bytea) returns setof tid</code>
  253. <a id="id-1.11.7.31.7.2.3.1.2" class="indexterm"></a>
  254. </span></dt><dd><p>
  255. <code class="function">brin_revmap_data</code> returns the list of tuple
  256. identifiers in a <acronym class="acronym">BRIN</acronym> index range map page.
  257. For example:
  258. </p><pre class="screen">
  259. test=# SELECT * FROM brin_revmap_data(get_raw_page('brinidx', 2)) LIMIT 5;
  260. pages
  261. ---------
  262. (6,137)
  263. (6,138)
  264. (6,139)
  265. (6,140)
  266. (6,141)
  267. </pre><p>
  268. </p></dd><dt><span class="term">
  269. <code class="function">brin_page_items(page bytea, index oid) returns setof record</code>
  270. <a id="id-1.11.7.31.7.2.4.1.2" class="indexterm"></a>
  271. </span></dt><dd><p>
  272. <code class="function">brin_page_items</code> returns the data stored in the
  273. <acronym class="acronym">BRIN</acronym> data page. For example:
  274. </p><pre class="screen">
  275. test=# SELECT * FROM brin_page_items(get_raw_page('brinidx', 5),
  276. 'brinidx')
  277. ORDER BY blknum, attnum LIMIT 6;
  278. itemoffset | blknum | attnum | allnulls | hasnulls | placeholder | value
  279. ------------+--------+--------+----------+----------+-------------+--------------
  280. 137 | 0 | 1 | t | f | f |
  281. 137 | 0 | 2 | f | f | f | {1 .. 88}
  282. 138 | 4 | 1 | t | f | f |
  283. 138 | 4 | 2 | f | f | f | {89 .. 176}
  284. 139 | 8 | 1 | t | f | f |
  285. 139 | 8 | 2 | f | f | f | {177 .. 264}
  286. </pre><p>
  287. The returned columns correspond to the fields in the
  288. <code class="structname">BrinMemTuple</code> and <code class="structname">BrinValues</code> structs.
  289. See <code class="filename">src/include/access/brin_tuple.h</code> for details.
  290. </p></dd></dl></div></div><div class="sect2" id="id-1.11.7.31.8"><div class="titlepage"><div><div><h3 class="title">F.22.5. GIN Functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  291. <code class="function">gin_metapage_info(page bytea) returns record</code>
  292. <a id="id-1.11.7.31.8.2.1.1.2" class="indexterm"></a>
  293. </span></dt><dd><p>
  294. <code class="function">gin_metapage_info</code> returns information about
  295. a <acronym class="acronym">GIN</acronym> index metapage. For example:
  296. </p><pre class="screen">
  297. test=# SELECT * FROM gin_metapage_info(get_raw_page('gin_index', 0));
  298. -[ RECORD 1 ]----+-----------
  299. pending_head | 4294967295
  300. pending_tail | 4294967295
  301. tail_free_size | 0
  302. n_pending_pages | 0
  303. n_pending_tuples | 0
  304. n_total_pages | 7
  305. n_entry_pages | 6
  306. n_data_pages | 0
  307. n_entries | 693
  308. version | 2
  309. </pre><p>
  310. </p></dd><dt><span class="term">
  311. <code class="function">gin_page_opaque_info(page bytea) returns record</code>
  312. <a id="id-1.11.7.31.8.2.2.1.2" class="indexterm"></a>
  313. </span></dt><dd><p>
  314. <code class="function">gin_page_opaque_info</code> returns information about
  315. a <acronym class="acronym">GIN</acronym> index opaque area, like the page type.
  316. For example:
  317. </p><pre class="screen">
  318. test=# SELECT * FROM gin_page_opaque_info(get_raw_page('gin_index', 2));
  319. rightlink | maxoff | flags
  320. -----------+--------+------------------------
  321. 5 | 0 | {data,leaf,compressed}
  322. (1 row)
  323. </pre><p>
  324. </p></dd><dt><span class="term">
  325. <code class="function">gin_leafpage_items(page bytea) returns setof record</code>
  326. <a id="id-1.11.7.31.8.2.3.1.2" class="indexterm"></a>
  327. </span></dt><dd><p>
  328. <code class="function">gin_leafpage_items</code> returns information about
  329. the data stored in a <acronym class="acronym">GIN</acronym> leaf page. For example:
  330. </p><pre class="screen">
  331. test=# SELECT first_tid, nbytes, tids[0:5] AS some_tids
  332. FROM gin_leafpage_items(get_raw_page('gin_test_idx', 2));
  333. first_tid | nbytes | some_tids
  334. -----------+--------+----------------------------------------------------------
  335. (8,41) | 244 | {"(8,41)","(8,43)","(8,44)","(8,45)","(8,46)"}
  336. (10,45) | 248 | {"(10,45)","(10,46)","(10,47)","(10,48)","(10,49)"}
  337. (12,52) | 248 | {"(12,52)","(12,53)","(12,54)","(12,55)","(12,56)"}
  338. (14,59) | 320 | {"(14,59)","(14,60)","(14,61)","(14,62)","(14,63)"}
  339. (167,16) | 376 | {"(167,16)","(167,17)","(167,18)","(167,19)","(167,20)"}
  340. (170,30) | 376 | {"(170,30)","(170,31)","(170,32)","(170,33)","(170,34)"}
  341. (173,44) | 197 | {"(173,44)","(173,45)","(173,46)","(173,47)","(173,48)"}
  342. (7 rows)
  343. </pre><p>
  344. </p></dd></dl></div></div><div class="sect2" id="id-1.11.7.31.9"><div class="titlepage"><div><div><h3 class="title">F.22.6. Hash Functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
  345. <code class="function">hash_page_type(page bytea) returns text</code>
  346. <a id="id-1.11.7.31.9.2.1.1.2" class="indexterm"></a>
  347. </span></dt><dd><p>
  348. <code class="function">hash_page_type</code> returns page type of
  349. the given <acronym class="acronym">HASH</acronym> index page. For example:
  350. </p><pre class="screen">
  351. test=# SELECT hash_page_type(get_raw_page('con_hash_index', 0));
  352. hash_page_type
  353. ----------------
  354. metapage
  355. </pre><p>
  356. </p></dd><dt><span class="term">
  357. <code class="function">hash_page_stats(page bytea) returns setof record</code>
  358. <a id="id-1.11.7.31.9.2.2.1.2" class="indexterm"></a>
  359. </span></dt><dd><p>
  360. <code class="function">hash_page_stats</code> returns information about
  361. a bucket or overflow page of a <acronym class="acronym">HASH</acronym> index.
  362. For example:
  363. </p><pre class="screen">
  364. test=# SELECT * FROM hash_page_stats(get_raw_page('con_hash_index', 1));
  365. -[ RECORD 1 ]---+-----------
  366. live_items | 407
  367. dead_items | 0
  368. page_size | 8192
  369. free_size | 8
  370. hasho_prevblkno | 4096
  371. hasho_nextblkno | 8474
  372. hasho_bucket | 0
  373. hasho_flag | 66
  374. hasho_page_id | 65408
  375. </pre><p>
  376. </p></dd><dt><span class="term">
  377. <code class="function">hash_page_items(page bytea) returns setof record</code>
  378. <a id="id-1.11.7.31.9.2.3.1.2" class="indexterm"></a>
  379. </span></dt><dd><p>
  380. <code class="function">hash_page_items</code> returns information about
  381. the data stored in a bucket or overflow page of a <acronym class="acronym">HASH</acronym>
  382. index page. For example:
  383. </p><pre class="screen">
  384. test=# SELECT * FROM hash_page_items(get_raw_page('con_hash_index', 1)) LIMIT 5;
  385. itemoffset | ctid | data
  386. ------------+-----------+------------
  387. 1 | (899,77) | 1053474816
  388. 2 | (897,29) | 1053474816
  389. 3 | (894,207) | 1053474816
  390. 4 | (892,159) | 1053474816
  391. 5 | (890,111) | 1053474816
  392. </pre><p>
  393. </p></dd><dt><span class="term">
  394. <code class="function">hash_bitmap_info(index oid, blkno int) returns record</code>
  395. <a id="id-1.11.7.31.9.2.4.1.2" class="indexterm"></a>
  396. </span></dt><dd><p>
  397. <code class="function">hash_bitmap_info</code> shows the status of a bit
  398. in the bitmap page for a particular overflow page of <acronym class="acronym">HASH</acronym>
  399. index. For example:
  400. </p><pre class="screen">
  401. test=# SELECT * FROM hash_bitmap_info('con_hash_index', 2052);
  402. bitmapblkno | bitmapbit | bitstatus
  403. -------------+-----------+-----------
  404. 65 | 3 | t
  405. </pre><p>
  406. </p></dd><dt><span class="term">
  407. <code class="function">hash_metapage_info(page bytea) returns record</code>
  408. <a id="id-1.11.7.31.9.2.5.1.2" class="indexterm"></a>
  409. </span></dt><dd><p>
  410. <code class="function">hash_metapage_info</code> returns information stored
  411. in meta page of a <acronym class="acronym">HASH</acronym> index. For example:
  412. </p><pre class="screen">
  413. test=# SELECT magic, version, ntuples, ffactor, bsize, bmsize, bmshift,
  414. test-# maxbucket, highmask, lowmask, ovflpoint, firstfree, nmaps, procid,
  415. test-# regexp_replace(spares::text, '(,0)*}', '}') as spares,
  416. test-# regexp_replace(mapp::text, '(,0)*}', '}') as mapp
  417. test-# FROM hash_metapage_info(get_raw_page('con_hash_index', 0));
  418. -[ RECORD 1 ]-------------------------------------------------------------------------------
  419. magic | 105121344
  420. version | 4
  421. ntuples | 500500
  422. ffactor | 40
  423. bsize | 8152
  424. bmsize | 4096
  425. bmshift | 15
  426. maxbucket | 12512
  427. highmask | 16383
  428. lowmask | 8191
  429. ovflpoint | 28
  430. firstfree | 1204
  431. nmaps | 1
  432. procid | 450
  433. 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}
  434. mapp | {65}
  435. </pre><p>
  436. </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="ltree.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="passwordcheck.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.21. ltree </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> F.23. passwordcheck</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1