RefLib

Reference library for AI

Back

postgresql_16:9.6.25.6 GiST Functions

PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > pageinspect — low-level inspection of database pages > GiST Functions

gist_page_opaque_info(page bytea) returns record

gist_page_opaque_info returns information from a GiST index page's opaque area, such as the NSN, rightlink and page type. For example: 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)

gist_page_items(page bytea, index_oid regclass) returns setof record

gist_page_items returns information about the data stored in a page of a GiST index. For example: 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)

gist_page_items_bytea(page bytea) returns setof record

Same as gist_page_items, but returns the key data as a raw bytea blob. Since it does not attempt to decode the key, it does not need to know which index is involved. For example: 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 | \x00000100ffff28000000000000c0644000000000​00c06440000000000000f03f000000000000f03f 2 | (2,65535) | 40 | f | \x00000200ffff28000000000000c0744000000000​00c074400000000000e064400000000000e06440 3 | (3,65535) | 40 | f | \x00000300ffff28000000000000207f4000000000​00207f400000000000d074400000000000d07440 4 | (4,65535) | 40 | f | \x00000400ffff28000000000000c0844000000000​00c084400000000000307f400000000000307f40 5 | (5,65535) | 40 | f | \x00000500ffff28000000000000f0894000000000​00f089400000000000c884400000000000c88440 6 | (6,65535) | 40 | f | \x00000600ffff28000000000000208f4000000000​00208f400000000000f889400000000000f88940 7 | (7,65535) | 40 | f | \x00000700ffff28000000000000408f4000000000​00408f400000000000288f400000000000288f40 (7 rows)

Back