Skip site navigation (1) Skip section navigation (2)

Re: extending relations more efficiently

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jeroen Vermeulen <jtv(at)xs4all(dot)nl>, Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: extending relations more efficiently
Date: 2012-05-02 16:46:37
Message-ID: 1335977039-sup-3272@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Excerpts from Robert Haas's message of mié may 02 12:37:35 -0400 2012:
> 
> On Wed, May 2, 2012 at 12:26 PM, Alvaro Herrera
> <alvherre(at)commandprompt(dot)com> wrote:
> > Excerpts from Robert Haas's message of mié may 02 08:14:36 -0400 2012:
> >> On Wed, May 2, 2012 at 7:16 AM, Jeroen Vermeulen <jtv(at)xs4all(dot)nl> wrote:
> >> > On 2012-05-01 22:06, Robert Haas wrote:
> >> >> It might also be interesting to provide a mechanism to pre-extend a
> >> >> relation to a certain number of blocks, though if we did that we'd
> >> >> have to make sure that autovac got the memo not to truncate those
> >> >> pages away again.
> >> >
> >> > Good point.  And just to check before skipping over it, do we know that
> >> > autovacuum not leaving enough slack space is not a significant cause of the
> >> > bottlenecks in the first place?
> >>
> >> I'm not sure exactly what you mean by this: autovacuum doesn't need
> >> any slack space.  Regular DML operations can certainly benefit from
> >> slack space, both within each page and overall within the relation.
> >> But there's no evidence that vacuum is doing too good a job cleaning
> >> up the mess, forcing the relation to be re-extended.  Rather, the
> >> usual (and frequent) complaint is that vacuum is leaving way too much
> >> slack space - i.e. bloat.
> >
> > Hm.  I see those two things as different -- to me, bloat is unremoved
> > dead tuples, whereas slack space would be free space that can be reused
> > by new tuples.  Slack space is useful as it avoids relation extension;
> > bloat is not.
> 
> I guess I think of bloat as including both unremoved dead tuples and
> unwanted internal free space.  If you create a giant table, delete 9
> out of every 10 tuples, and vacuum, the table is still "bloated", IMV.

Agreed.  Perhaps to solve this issue what we need is a way to migrate
tuples from later pages into earlier ones.  (This was one of the points,
never resolved, that we discussed during the VACUUM FULL rework.)

> > I wonder, though, if we should set a less-than-100 fillfactor for heap
> > relations.  Just like default_statistic_target, it seems that the
> > default value should be a conservative tradeoff between two extremes.
> > This doesn't help extension for bulk insertions a lot, of course, but
> > it'd be useful for tables where HOT updates happen with some regularity.
> 
> Perhaps, but in theory that should be self-correcting: the data should
> spread itself onto the number of pages where HOT pruning is able to
> prevent further relation extension.

True.  I gather you consider that the cases where it doesn't happen due
to particular conditions are the ones that need manual tweaking.

-- 
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2012-05-02 16:55:17
Subject: Re: extending relations more efficiently
Previous:From: Tom LaneDate: 2012-05-02 16:45:35
Subject: Re: extending relations more efficiently

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group