Re: Measuring relation free space

Jaime Casanova <jaime@2ndquadrant.com>

From: Jaime Casanova <jaime@2ndquadrant.com>
To: Noah Misch <noah@leadboat.com>
Cc: Bernd Helmle <mailings@oopsware.de>, Greg Smith <greg@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2012-01-18T14:46:20Z
Lists: pgsql-hackers
On Mon, Jan 16, 2012 at 5:09 AM, Noah Misch <noah@leadboat.com> wrote:
>
> pgstattuple()'s decision to treat half-dead pages like deleted pages is
> better.  That transient state can only end in the page's deletion.
>

the only page in that index has 200 records (all live 0 dead) using
half the page size (which is a leaf page and is not half dead, btw).
so, how do you justify that pgstattuple say we have just 25% of free
space?

postgres=# SELECT * from bt_page_stats('pgbench_tellers_pkey', 1);
-[ RECORD 1 ]-+-----
blkno              | 1
type               | l
live_items       | 200
dead_items     | 0
avg_item_size | 16
page_size       | 8192
free_size         | 4148
btpo_prev        | 0
btpo_next        | 0
btpo                | 0
btpo_flags       | 3

> I don't know about counting non-leaf pages

ignoring all non-leaf pages still gives a considerable difference
between pgstattuple and relation_free_space()

-- 
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación