Re: Documentation of bt_page_items()'s ctid field

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Documentation of bt_page_items()'s ctid field
Date: 2015-03-10 00:18:19
Message-ID: CAMkU=1w5YE8-n_QyLNPxnYuR7p-a-5+v_Y0p_CfDko+DTqs8bA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 9, 2015 at 4:06 PM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:

> On Mon, Mar 9, 2015 at 3:51 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> > How do I know if I am looking at a non-rightmost page?
>
> It has a right-link (that's the easiest way to tell).

Meaning that btpo_next is not zero? Should we say that in the patch in so
many words? I think it will be hard to explain the page_items more without
also explaining the page_stats more.

> It will (as the
> docpatch points out) also necessarily have a ""high key" item. We
> know that we have to move right if the high key doesn't bound the
> value we expected to find on the page (our scankey item - what the
> index scan is searching for). So the high key goes with having a
> rightlink, and in general we detect that we're looking at a
> non-rightmost page based on the presence of a right-link.
>

So if I understand this correctly, if there is a high key it is itemoffset
1, but to know whether itemoffset 1 is a high key I first have to look at
btpo_next.

And if there is a minus infinity, it will either be itemoffset 2 or 1,
depending on whether there is a high key or not.

Thanks,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-03-10 00:34:52 Re: Documentation of bt_page_items()'s ctid field
Previous Message Tom Lane 2015-03-09 23:34:41 Re: BRIN page type identifier