RefLib

Reference library for AI

Back

postgresql_16:9.6.25.4 BRIN Functions

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

brin_page_type(page bytea) returns text

brin_page_type returns the page type of the given BRIN index page, or throws an error if the page is not a valid BRIN page. For example: test=# SELECT brin_page_type(get_raw_page('brinidx', 0)); brin_page_type ---------------- meta

brin_metapage_info(page bytea) returns record

brin_metapage_info returns assorted information about a BRIN index metapage. For example: test=# SELECT * FROM brin_metapage_info(get_raw_page('brinidx', 0)); magic | version | pagesperrange | lastrevmappage ------------+---------+---------------+---------------- 0xA8109CFA | 1 | 4 | 2

brin_revmap_data(page bytea) returns setof tid

brin_revmap_data returns the list of tuple identifiers in a BRIN index range map page. For example: test=# SELECT * FROM brin_revmap_data(get_raw_page('brinidx', 2)) LIMIT 5; pages --------- (6,137) (6,138) (6,139) (6,140) (6,141)

brin_page_items(page bytea, index oid) returns setof record

brin_page_items returns the data stored in the BRIN data page. For example: test=# SELECT * FROM brin_page_items(get_raw_page('brinidx', 5), 'brinidx') ORDER BY blknum, attnum LIMIT 6; itemoffset | blknum | attnum | allnulls | hasnulls | placeholder | empty | value ------------+--------+--------+----------+----------+-------------+-------+-------------- 137 | 0 | 1 | t | f | f | f | 137 | 0 | 2 | f | f | f | f | {1 .. 88} 138 | 4 | 1 | t | f | f | f | 138 | 4 | 2 | f | f | f | f | {89 .. 176} 139 | 8 | 1 | t | f | f | f | 139 | 8 | 2 | f | f | f | f | {177 .. 264} The returned columns correspond to the fields in the BrinMemTuple and BrinValues structs. See src/include/access/brin_tuple.h for details.

Back