Re: Measuring relation free space - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Measuring relation free space
Date
Msg-id 20120121013330.GA810@tornado.leadboat.com
Whole thread Raw
In response to Re: Measuring relation free space  (Jaime Casanova <jaime@2ndquadrant.com>)
Responses Re: Measuring relation free space  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On Fri, Jan 20, 2012 at 07:03:22PM -0500, Jaime Casanova wrote:
> On Wed, Jan 18, 2012 at 7:01 PM, Noah Misch <noah@leadboat.com> wrote:
> > On Wed, Jan 18, 2012 at 09:46:20AM -0500, Jaime Casanova wrote:
> >>
> >> ignoring all non-leaf pages still gives a considerable difference
> >> between pgstattuple and relation_free_space()
> >
> > pgstattuple() counts the single B-tree meta page as always-full, while
> > relation_free_space() skips it for all purposes. ?For tiny indexes, that can
> > shift the percentage dramatically.
> >
> 
> ok, i will reformulate the question. why is fine ignoring non-leaf
> pages but is not fine to ignore the meta page?

pgstattuple() figures the free_percent by adding up all space available to
hold tuples and dividing that by the simple size of the relation.  Non-leaf
pages and the meta page get identical treatment: both never hold tuples, so
they do not contribute to the free space.


pgsql-hackers by date:

Previous
From: Kääriäinen Anssi
Date:
Subject: REVIEW: pg_stat_statements with query tree based normalization
Next
From: Robert Haas
Date:
Subject: Re: Should I implement DROP INDEX CONCURRENTLY?