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

From Jaime Casanova
Subject Re: Measuring relation free space
Date
Msg-id CAJKUy5jWD-nDEzzX6x7H8TMO3uRhV=AdOF2Sr8Wiz+ecCfzTDg@mail.gmail.com
Whole thread Raw
In response to Re: Measuring relation free space  (Noah Misch <noah@leadboat.com>)
Responses Re: Measuring relation free space  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
On Mon, Jan 23, 2012 at 7:18 PM, Noah Misch <noah@leadboat.com> wrote:
> On Mon, Jan 23, 2012 at 04:56:24PM -0300, Alvaro Herrera wrote:
>>
>> Hm.  Leaf pages hold as much tuples as non-leaf pages, no?  I mean
>> for each page element there's a value and a CTID.  In non-leaf those
>> CTIDs point to other index pages, one level down the tree; in leaf pages
>> they point to the heap.
>
> That distinction seemed important when I sent my last message, but now I agree
> that it's largely irrelevant for free space purposes.  If someone feels like
> doing it, +1 for making pgstattuple() count non-leaf free space.
>

actually i agreed that non-leaf pages are irrelevant... i just
confirmed that in a production system with 300GB none of the indexes
in an 84M rows table nor in a heavily updated one has more than 1 root
page, all the rest are deleted, half_dead or leaf. so the posibility
of bloat coming from non-leaf pages seems very odd

but the possibility of bloat coming from the meta page doesn't exist,
AFAIUI at least

we need the most accurate value about usable free space, because the
idea is to add a sampler mode to the function so we don't scan the
whole relation. that's why we still need the function.

btw... pgstattuple also has the problem that it's not using a ring buffer


attached are two patches:
- v5: is the same original patch but only track space in leaf, deleted
and half_dead pages
- v5.1: adds the same for all kind of indexes (problem is that this is
inconsistent with the fact that pageinspect only manages btree indexes
for everything else)

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

Attachment

pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: GUC_REPORT for protocol tunables was: Re: Optimize binary serialization format of arrays with fixed size elements
Next
From: Tom Lane
Date:
Subject: Re: Multithread Query Planner