pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: pageinspect bt_page_items doc
Date: Mon, 24 Jul 2023 09:46:30 +0800
Message-ID: <20230724014630.zz7xqa4ynmvh2aw2@jrouhaud> (raw)
In-Reply-To: <CACJufxG9bvBRC9zT_ph-MC9jZEOawyqR=ESs5wCG59j2Jxu2Rg@mail.gmail.com>
References: <CACJufxG9bvBRC9zT_ph-MC9jZEOawyqR=ESs5wCG59j2Jxu2Rg@mail.gmail.com>

Hi,

On Mon, Jul 24, 2023 at 08:57:05AM +0800, jian he wrote:
> hi.
>
> https://www.postgresql.org/docs/current/pageinspect.html#id-1.11.7.34.6
>
> > This is a B-tree leaf page. All tuples that point to the table happen to be posting list tuples (all of which store a total of 100 6 byte TIDs).
> > There is also a “high key” tuple at itemoffset number 1. ctid is used to store encoded information about each tuple in this example, though
> > leaf page tuples often store a heap TID directly in the ctid field instead. tids is the list of TIDs stored as a posting list.
>
> (all of which store a total of 100 6 byte TIDs)
> I think the meaning is something like:
> (all of which store a total of 100 TIDs, each TID is 6 byte long.)

Yes that's what it means.

>  What's the meaning of  (16, 8292)?  After looking around. I'm still confused.
> Would it be better to add an explanation about (16, 8292) to the docs?

I'm not sure how easy it would be to document it.  If you want more detail
about "encoded information about each tuple" you need to look at the btree
implementation, in src/include/access/nbtree.h.

For instance, to get the number of items in a posting list, you see the
BTreeTupleGetNPosting() function, which basically returns ctid & 0X0FFF.  And
8292 & 0X0FFF is 100, which is the mentioned number of tids.  If you look
around line 462 of the same file (near the BT_OFFSET_MASK) you will see all the
other usage for the ctid in case of a posting list, like knowing whether the
IndexTuple is a posting list of not.





view thread (2+ messages)

Message-ID: <20230724014630.zz7xqa4ynmvh2aw2@jrouhaud>
Permalink:  ../20230724014630.zz7xqa4ynmvh2aw2@jrouhaud/
Also on:    postgresql.org/message-id/20230724014630.zz7xqa4ynmvh2aw2@jrouhaud

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: rjuju123@gmail.com, jian.universality@gmail.com
  Subject: Re: pageinspect bt_page_items doc
  In-Reply-To: <20230724014630.zz7xqa4ynmvh2aw2@jrouhaud>
  References: <CACJufxG9bvBRC9zT_ph-MC9jZEOawyqR=ESs5wCG59j2Jxu2Rg@mail.gmail.com> <20230724014630.zz7xqa4ynmvh2aw2@jrouhaud>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox