On Mon, Mar 9, 2015 at 5:18 PM, Jeff Janes <jeff.ja...@gmail.com> wrote: >> 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.
Yes. And my wording above was sloppy: By definition, a non-rightmost page is a page that has a rightlink (it will also have a highkey, but that's certainly not how we distinguish them). Attached patch adds a definition of non-rightmost in parenthesis, which I think helps. > 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. Yes. The logic for caring about "minus infinity" items within internal pages is hardcoded into _bt_compare(), so it's kind of a low-level detail, even by these standards...but it comes up with pageinspect, since they consume an IndexTuple. Confusion ensues. > 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. That's correct. So "data" can be "(has data), (has no data), (has data), (has data) .... " on a given page, which could freak users out. -- Peter Geoghegan
diff --git a/doc/src/sgml/pageinspect.sgml b/doc/src/sgml/pageinspect.sgml index 6f51dc6..502903c 100644 --- a/doc/src/sgml/pageinspect.sgml +++ b/doc/src/sgml/pageinspect.sgml @@ -192,6 +192,17 @@ test=# SELECT * FROM bt_page_items('pg_cast_oid_index', 1); 7 | (0,7) | 12 | f | f | 29 27 00 00 8 | (0,8) | 12 | f | f | 2a 27 00 00 </screen> + In a B-tree leaf page, <structfield>ctid</> points to a heap + tuple. In an internal page, it points to another page in the + index itself, and the offset number part (the second number) of + the <structfield>ctid</> field is ignored. Note that the first + item on any non-rightmost page (any page lacking a + <structfield>btpo_next</> field) is the page <quote>high + key</quote>, meaning its <structfield>data</> serves as an upper + bound on all items appearing on the page. Also, on non-leaf + pages, the first "data item" (the first item that is not a high + key) is a <quote>minus infinity</quote> item, implying that its + <structfield>data</> field lacks any value. </para> </listitem> </varlistentry>
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers