a bit strange btree index tuples

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: a bit strange btree index tuples
Date: 2011-05-01 02:30:53
Message-ID: 4DBCC5DD.8040509@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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=8168
lp_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,"00 01 00 00")
(258,"(1,2)",12,f,f,"01 01 00 00")
...

but I still wonder what is the index tuple for.

regards
Tomas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-05-01 03:19:58 Re: increasing collapse_limits?
Previous Message Tomas Vondra 2011-05-01 02:17:04 a bit more precise MaxOffsetNumber