Re: Documentation of bt_page_items()'s ctid field

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Documentation of bt_page_items()'s ctid field
Дата
Msg-id CAMkU=1w5YE8-n_QyLNPxnYuR7p-a-5+v_Y0p_CfDko+DTqs8bA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Documentation of bt_page_items()'s ctid field  (Peter Geoghegan <pg@heroku.com>)
Ответы Re: Documentation of bt_page_items()'s ctid field  (Peter Geoghegan <pg@heroku.com>)
Список pgsql-hackers

On Mon, Mar 9, 2015 at 4:06 PM, Peter Geoghegan <pg@heroku.com> wrote:
On Mon, Mar 9, 2015 at 3:51 PM, Jeff Janes <jeff.janes@gmail.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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BRIN page type identifier
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Documentation of bt_page_items()'s ctid field