Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ?

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ?
Дата
Msg-id CAM3SWZT2UaCTqpd71uhUVQN7b7k4treyzGyQLpv4N=TYU=F7tg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ?
Список pgsql-hackers
On Thu, Feb 18, 2016 at 10:01 AM, Tom Lane <tgl@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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [DOCS] The number of bytes is stored in index_size of pgstatindex() ?