a bit strange btree index tuples - Mailing list pgsql-hackers

From Tomas Vondra
Subject a bit strange btree index tuples
Date
Msg-id 4DBCC5DD.8040509@fuzzy.cz
Whole thread Raw
Responses Re: a bit strange btree index tuples  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

when working on the integrity checking tool, I've noticed there are a
bit trange tuples in the btree indexes. E.g. if I do this:

create table test_table (id int);
insert into test_table select i from generate_series(1,1000) s(i);
create index test_index on test_table(id);

then pageinspect returns this:

testdb=# select bt_page_items('test_index', 3);         bt_page_items
----------------------------------(1,"(1,1)",8,f,f,"")(2,"(2,1)",12,f,f,"ca 01 00 00")(3,"(4,1)",12,f,f,"93 03 00 00")
(3 rows)

I don't understand the first row and I've been unable to find out if
it's something special for the btree indexes or what.

According to ItemId in the PageHeader the tuple has these features
lp_flags=1 (LP_NORMAL)lp_off=8168lp_len=8 (i.e. exactly sizeof(IndexTuple)

and according to the IndexTuple, t_info=8 (so the length is 8 and it
does not have any NULL or varwidth attributes).

Yes, the lengths in page header and tuple match (8 in both cases) but
where are the attributes?

I've noticed there is yet another index tuple for ctid=(1,1), right on
the first page of the index

select bt_page_items('test_index', 1);...(255,"(0,254)",12,f,f,"fe 00 00 00")(256,"(0,255)",12,f,f,"ff 00 00
00")(257,"(1,1)",12,f,f,"0001 00 00")(258,"(1,2)",12,f,f,"01 01 00 00")...
 

but I still wonder what is the index tuple for.

regards
Tomas


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: a bit more precise MaxOffsetNumber
Next
From: Tom Lane
Date:
Subject: Re: increasing collapse_limits?