mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-31 05:37:25 +02:00
Add a new bt_metap() column to display the metapage's allequalimage
field. Also add three new columns to contrib/pageinspect's
bt_page_items() function:
* Add a boolean column ("dead") that displays the LP_DEAD bit value for
each non-pivot tuple.
* Add a TID column ("htid") that displays a single heap TID value for
each tuple. This is the TID that is returned by BTreeTupleGetHeapTID(),
so comparable values are shown for pivot tuples, plain non-pivot tuples,
and posting list tuples.
* Add a TID array column ("tids") that displays TIDs from each tuple's
posting list, if any. This works just like the "tids" column from
pageinspect's gin_leafpage_items() function.
No version bump for the pageinspect extension, since there hasn't been a
stable Postgres release since the last version bump (the last bump was
part of commit 58b4cb30
).
Author: Peter Geoghegan
Discussion: https://postgr.es/m/CAH2-WzmSMmU2eNvY9+a4MNP+z02h6sa-uxZvN3un6jY02ZVBSw@mail.gmail.com
68 lines
1.8 KiB
Plaintext
68 lines
1.8 KiB
Plaintext
CREATE TABLE test1 (a int8, b text);
|
|
INSERT INTO test1 VALUES (72057594037927937, 'text');
|
|
CREATE INDEX test1_a_idx ON test1 USING btree (a);
|
|
\x
|
|
SELECT * FROM bt_metap('test1_a_idx');
|
|
-[ RECORD 1 ]-----------+-------
|
|
magic | 340322
|
|
version | 4
|
|
root | 1
|
|
level | 0
|
|
fastroot | 1
|
|
fastlevel | 0
|
|
oldest_xact | 0
|
|
last_cleanup_num_tuples | -1
|
|
allequalimage | t
|
|
|
|
SELECT * FROM bt_page_stats('test1_a_idx', 0);
|
|
ERROR: block 0 is a meta page
|
|
SELECT * FROM bt_page_stats('test1_a_idx', 1);
|
|
-[ RECORD 1 ]-+-----
|
|
blkno | 1
|
|
type | l
|
|
live_items | 1
|
|
dead_items | 0
|
|
avg_item_size | 16
|
|
page_size | 8192
|
|
free_size | 8128
|
|
btpo_prev | 0
|
|
btpo_next | 0
|
|
btpo | 0
|
|
btpo_flags | 3
|
|
|
|
SELECT * FROM bt_page_stats('test1_a_idx', 2);
|
|
ERROR: block number out of range
|
|
SELECT * FROM bt_page_items('test1_a_idx', 0);
|
|
ERROR: block 0 is a meta page
|
|
SELECT * FROM bt_page_items('test1_a_idx', 1);
|
|
-[ RECORD 1 ]-----------------------
|
|
itemoffset | 1
|
|
ctid | (0,1)
|
|
itemlen | 16
|
|
nulls | f
|
|
vars | f
|
|
data | 01 00 00 00 00 00 00 01
|
|
dead | f
|
|
htid | (0,1)
|
|
tids |
|
|
|
|
SELECT * FROM bt_page_items('test1_a_idx', 2);
|
|
ERROR: block number out of range
|
|
SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 0));
|
|
ERROR: block is a meta page
|
|
SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 1));
|
|
-[ RECORD 1 ]-----------------------
|
|
itemoffset | 1
|
|
ctid | (0,1)
|
|
itemlen | 16
|
|
nulls | f
|
|
vars | f
|
|
data | 01 00 00 00 00 00 00 01
|
|
dead | f
|
|
htid | (0,1)
|
|
tids |
|
|
|
|
SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 2));
|
|
ERROR: block number 2 is out of range for relation "test1_a_idx"
|
|
DROP TABLE test1;
|