On Thu, Feb 18, 2016 at 10:01 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Yeah ... the numbers already appear not to add up because the root page > is counted in index_size but not any other column, so there's already > something worthy of explanation there. Maybe something like "The reported > index_size will normally correspond to two more pages than are accounted > for by internal_pages + leaf_pages + empty_pages + deleted_pages, because > it also includes the index's metapage and root page".
That's odd. Having taken a quick look at pgstatindex_impl(), I dislike that it counts the root separately from internal pages. That's not how they're actually presented and understood in the code. It's also possible to have more than one root page, since we do a scan in physical order, which the code considers. There could be a fast root and a true root. Looks like one is counted as deleted, though: regression=# select index_size/2^13 as total_pages, root_block_no, internal_pages, leaf_pages, deleted_pages from pgstatindex('btree_tall_idx'); total_pages │ root_block_no │ internal_pages │ leaf_pages │ deleted_pages ─────────────┼───────────────┼────────────────┼────────────┼─────────────── 206 │ 81 │ 3 │ 160 │ 42 (1 row) BTW, I am actively working on the amcheck B-Tree checker tool, and hope to post it soon. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers