Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qNkes-005qkf-Mu for pgsql-general@arkaria.postgresql.org; Mon, 24 Jul 2023 01:46:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qNker-006jQq-2A for pgsql-general@arkaria.postgresql.org; Mon, 24 Jul 2023 01:46:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qNkeq-006jQh-NQ for pgsql-general@lists.postgresql.org; Mon, 24 Jul 2023 01:46:44 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qNkei-001Q9t-IX for pgsql-general@lists.postgresql.org; Mon, 24 Jul 2023 01:46:43 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1b8ad907ba4so18429675ad.0 for ; Sun, 23 Jul 2023 18:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690163195; x=1690767995; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=+qGsxTtD01exr2HOAWQMeKeoECjii+LJ3Wbyy3wQAic=; b=JtjlUBk8rBEvDFOQ2bSTuuz5Fb9wvRnEljKW/l9jYyIoibz+brsACyKUGIpqiIE380 b1OEjmtualYG9sw8dr8qHUeayUiUgo+cc2+3FhX5zbWb1xXFbdI1crLHUQ2LNjpG2ASy zWH+KqZluot9I9CYaAZDMxcvb9FX7aBOx2vCpGCwbv5sbsv5ufeV+UbFERaJ8/heL0SR d5WZLpgDolnu9l5eh2sUTjv8vtkf2gSlhCx03BJ3867dccygSYXFee/sOTBfFSQZYZNs GF+yEXwDiWZCeljryDbSDXf+PJSG8w7bN3cejZEqvCCdr0t3qmwdod2tnRwIOUseUJC7 CYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690163195; x=1690767995; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+qGsxTtD01exr2HOAWQMeKeoECjii+LJ3Wbyy3wQAic=; b=KS9tMFoF5A6RLmmxWfz16EGoN26Af4B86/2NM73elgQG7UtkXkxaOsCNkgMSdN3liu wXVANbs82a471jl6Gjf5+QZvPyVWg0TJ0XUUAN2iT0LeEhm9WjiEUFPeSFceU3fcFd/I CLrzqPSeB+WWyZR/O6H0r9j2dMtj0VhtSLyrEBkngp9P4Nvs3DzjLMY8e3yKiIWDbupn Mk4Je6iijlNRotSbWTqlsL24JpSuJoLZQKmvGMuJemR5MF+Ks/BVxy/N8ZhK2EdhUpYM PVuY5MtCPrbal9V01W6siAlJ89yD4UpieXCQAw6guM+sPKFZm3qxImsFPzjwdi3sRLMd TduQ== X-Gm-Message-State: ABy/qLYHrApHHEzDAWY1fG1k18eJxln0ggubjGG1L++SobIPb0/QAYtO EFVIVM5FGf3p5ElFPGPNL/I= X-Google-Smtp-Source: APBJJlEZofCMh1OFg5C8hCTiLyIgh/7PI9EOovCLF11/3rP1G+I64mDBaEei0dVL7H2bjLcl1ms74g== X-Received: by 2002:a17:902:e542:b0:1b9:ebf4:5d2 with SMTP id n2-20020a170902e54200b001b9ebf405d2mr7006086plf.33.1690163195300; Sun, 23 Jul 2023 18:46:35 -0700 (PDT) Received: from jrouhaud (2001-b011-1005-954c-ec6e-04c3-2381-d4ef.dynamic-ip6.hinet.net. [2001:b011:1005:954c:ec6e:4c3:2381:d4ef]) by smtp.gmail.com with ESMTPSA id i5-20020a170902c94500b001bb1f0605b2sm7459543pla.214.2023.07.23.18.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 18:46:34 -0700 (PDT) Date: Mon, 24 Jul 2023 09:46:30 +0800 From: Julien Rouhaud To: jian he Cc: pgsql-general list Subject: Re: pageinspect bt_page_items doc Message-ID: <20230724014630.zz7xqa4ynmvh2aw2@jrouhaud> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.