From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | 大塚憲司 <otsuka(dot)kenji(at)nttcom(dot)co(dot)jp>, pgsql-docs(at)postgresql(dot)org, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ? |
Date: | 2016-02-18 18:35:21 |
Message-ID: | CAM3SWZT2UaCTqpd71uhUVQN7b7k4treyzGyQLpv4N=TYU=F7tg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-hackers |
On Thu, Feb 18, 2016 at 10:01 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-02-18 18:49:31 | Re: [HACKERS] The number of bytes is stored in index_size of pgstatindex() ? |
Previous Message | Tom Lane | 2016-02-18 18:01:10 | Re: [HACKERS] The number of bytes is stored in index_size of pgstatindex() ? |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-02-18 18:49:31 | Re: [HACKERS] The number of bytes is stored in index_size of pgstatindex() ? |
Previous Message | Tom Lane | 2016-02-18 18:01:10 | Re: [HACKERS] The number of bytes is stored in index_size of pgstatindex() ? |