Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
PostgreSQL 9.4.1 Documentation
PrevUpAppendix F. Additional Supplied ModulesNext

F.22. pageinspect

Thepageinspect 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.

F.22.1. Functions

get_raw_page(relname text, fork text, blkno int) returns bytea

get_raw_page reads the specified block of the named relation and returns a copy as abytea value. This allows a single time-consistent copy of the block to be obtained.fork should be'main' for the main data fork,'fsm' for the free space map,'vm' for the visibility map, or'init' for the initialization fork.

get_raw_page(relname text, blkno int) returns bytea

A shorthand version ofget_raw_page, for reading from the main fork. Equivalent toget_raw_page(relname, 'main', blkno)

page_header(page bytea) returns record

page_header shows fields that are common to allPostgreSQL heap and index pages.

A page image obtained withget_raw_page should be passed as argument. For example:

test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));    lsn    | checksum | flags  | lower | upper | special | pagesize | version | prune_xid-----------+----------+--------+-------+-------+---------+----------+---------+----------- 0/24A1B50 |        1 |      1 |   232 |   368 |    8192 |     8192 |       4 |         0

The returned columns correspond to the fields in thePageHeaderData struct. Seesrc/include/storage/bufpage.h for details.

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 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 withget_raw_page should be passed as argument. For example:

test=# SELECT * FROM heap_page_items(get_raw_page('pg_class', 0));

Seesrc/include/storage/itemid.h andsrc/include/access/htup_details.h for explanations of the fields returned.

bt_metap(relname text) returns record

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

test=# SELECT * FROM bt_metap('pg_cast_oid_index');-[ RECORD 1 ]-----magic     | 340322version   | 2root      | 1level     | 0fastroot  | 1fastlevel | 0

bt_page_stats(relname text, blkno int) returns record

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

test=# SELECT * FROM bt_page_stats('pg_cast_oid_index', 1);-[ RECORD 1 ]-+-----blkno         | 1type          | llive_items    | 256dead_items    | 0avg_item_size | 12page_size     | 8192free_size     | 4056btpo_prev     | 0btpo_next     | 0btpo          | 0btpo_flags    | 3

bt_page_items(relname text, blkno int) returns setof record

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

test=# SELECT * FROM bt_page_items('pg_cast_oid_index', 1); itemoffset |  ctid   | itemlen | nulls | vars |    data------------+---------+---------+-------+------+-------------          1 | (0,1)   |      12 | f     | f    | 23 27 00 00          2 | (0,2)   |      12 | f     | f    | 24 27 00 00          3 | (0,3)   |      12 | f     | f    | 25 27 00 00          4 | (0,4)   |      12 | f     | f    | 26 27 00 00          5 | (0,5)   |      12 | f     | f    | 27 27 00 00          6 | (0,6)   |      12 | f     | f    | 28 27 00 00          7 | (0,7)   |      12 | f     | f    | 29 27 00 00          8 | (0,8)   |      12 | f     | f    | 2a 27 00 00

fsm_page_contents(page bytea) returns text

fsm_page_contents shows the internal node structure of a FSM page. 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.

Seesrc/backend/storage/freespace/README for more information on the structure of an FSM page.


PrevHomeNext
ltreeUppasswordcheck
Go to PostgreSQL 9.4
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp