# F.23.pageinspect

F.23.1.一般功能F.23.2.堆函数F.23.3.B-树函数F.23.4.布林函数F.23.5.琴酒功能F.23.6.要点功能F.23.7.哈希函数

这个pageinspect模块提供的函数允许您在较低级别检查数据库页面的内容,这对于调试非常有用。所有这些功能只能由超级用户使用。

# F.23.1.一般功能

get_raw_页面(relname文本、fork文本、blkno bigint)返回bytea

获取原始页面读取命名关系的指定块,并返回一个副本作为二进制数据价值这允许获得块的单一时间一致性副本。**应该是“主要的”对于主数据分叉,“fsm”对于自由空间地图,“虚拟机”用于可见性地图,或“init”对于初始化分叉。

get_raw_page(relname text,blkno bigint)返回bytea

简写版的获取原始页面,用于从主叉读取。相当于获取原始页面(relname,'main',blkno)

页眉(页眉)返回记录

页眉显示所有PostgreSQL堆和索引页共有的字段。

使用获取原始页面应该作为论点通过。例如:

test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
    lsn    | checksum | flags  | lower | upper | special | pagesize | version | prune_xid
### F.23.2. Heap Functions

`heap_page_items(page bytea) returns setof record` []()

`heap_page_items` 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.

 A heap page image obtained with `get_raw_page` should be passed as argument. For example:

测试=#从堆页面_项中选择*(获取原始页面('pg_类',0));

 See `src/include/storage/itemid.h` and `src/include/access/htup_details.h` for explanations of the fields returned.

 The `heap_tuple_infomask_flags` function can be used to unpack the flag bits of `t_infomask` and `t_infomask2` for heap tuples.

`tuple_data_split(rel_oid oid, t_data bytea, t_infomask integer, t_infomask2 integer, t_bits text [, do_detoast bool]) returns bytea[]` []()

`tuple_data_split` splits tuple data into attributes in the same way as backend internals.

测试=#从堆页面项目(获取原始页面('pg_类',0))中选择元组数据分割('pg_类'::regclass,t_数据,t_信息掩码,t_信息mask2,t_位);

 This function should be called with the same arguments as the return attributes of `heap_page_items`.

 If *`do_detoast`* is `true`, attributes will be detoasted as needed. Default value is `false`.

`heap_page_item_attrs(page bytea, rel_oid regclass [, do_detoast bool]) returns setof record` []()

`heap_page_item_attrs` is equivalent to `heap_page_items` except that it returns tuple raw data as an array of attributes that can optionally be detoasted by *`do_detoast`* which is `false` by default.

 A heap page image obtained with `get_raw_page` should be passed as argument. For example:

test=#从heap_page_item_attrs(get_raw_page('pg_class',0),'pg_class'::regclass)中选择*;

`heap_tuple_infomask_flags(t_infomask integer, t_infomask2 integer) returns record` []()

`heap_tuple_infomask_flags` decodes the `t_infomask` and `t_infomask2` returned by `heap_page_items` 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:

测试=#从堆_页面_项(get_raw_page('pg_class',0))、横向堆_元组_infomask_标志(t_infomask,t_infomask2)中选择t_ctid、原始_标志、组合_标志,其中t_infomask不为NULL或t_infomask2不为NULL;

 This function should be called with the same arguments as the return attributes of `heap_page_items`.

 Combined flags are displayed for source-level macros that take into account the value of more than one raw bit, such as `HEAP_XMIN_FROZEN`.

 See `src/include/access/htup_details.h` for explanations of the flag names returned.

### F.23.3. B-Tree Functions

`bt_metap(relname text) returns record` []()

`bt_metap` returns information about a B-tree index's metapage. For example:

测试=#从bt_metap(“pg_cast_oid_index”)中选择*-[记录1]-------------+-------magic | 340322版本| 4 root | 1 level | 0 fastroot | 1 fastlevel | 0 last_cleanup | num | delpages | 0 last_cleanum | tuples | 230 allequalimage |

`bt_page_stats(relname text, blkno bigint) returns record` []()

`bt_page_stats` returns summary information about single pages of B-tree indexes. For example:

测试=#从bt_页面_统计中选择*(“pg_演员阵容_oid_索引”,1)-[记录1]-+-----blkno | 1类| 1活| 224死| 0平均|项目|大小| 16页|大小| 8192自由|大小| 3668 btpo |上一个|下一个| 0 btpo |级别| 0 btpo |旗帜|3

`bt_page_items(relname text, blkno bigint) returns setof record` []()

`bt_page_items` returns detailed information about all of the items on a B-tree index page. For example:

测试=#选择itemoffset、ctid、itemlen、nulls、VAR、data、dead、htid、TID[0:2]作为bt页面项目的一些TID('tenk2_-hund',5);itemoffset | ctid | itemlen | null | vars | data | dead | htid |部分|

# F.23.4.布林函数

brin_page_type(page bytea)返回文本

布林_页面_类型返回给定BRIN索引页的页类型,如果该页不是有效的BRIN页,则抛出错误。例如:

test=# SELECT brin_page_type(get_raw_page('brinidx', 0));
 brin_page_type
### F.23.5. GIN Functions

`gin_metapage_info(page bytea) returns record` []()

`gin_metapage_info` returns information about a GIN index metapage. For example:

测试=#从gin_图元页_信息中选择*(获取原始页面(“gin_索引”,0))-[记录1]----+-----------未决的|头| 4294967295未决的|尾| 4294967295尾部|自由的|大小| 0 n |未决的|页面| 0 n |未决的|元组| 0 n |总计|页面| 7 n |条目| 6 n |页面| 0 n | 693版本| 2

`gin_page_opaque_info(page bytea) returns record` []()

`gin_page_opaque_info` returns information about a GIN index opaque area, like the page type. For example:

测试=#从gin_页面_不透明_信息中选择*(获取原始_页面('gin_索引',2));rightlink | maxoff |标志

# F.23.6.要点功能

gist_page_不透明_info(page bytea)返回记录

要点页面不透明信息从摘要索引页的不透明区域返回信息,例如NSN、rightlink和页面类型。例如:

test=# SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));
 lsn | nsn | rightlink | flags  
### F.23.7. Hash Functions

`hash_page_type(page bytea) returns text` []()

`hash_page_type` returns page type of the given HASH index page. For example:

测试=#选择散列页面类型(获取原始页面('con_hash_index',0));散列页面类型