Re: Investigating the reason for a very big TOAST table size

From: Daniel Farina <daniel(at)heroku(dot)com>
To: Liron Shiri <lirons(at)checkpoint(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Investigating the reason for a very big TOAST table size
Date: 2012-08-28 08:57:58
Message-ID: CAAZKuFbvxMFAV06Tt25Q-2=Y1oO1nDL-GdkiU6_9rk2TkO0oKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Aug 27, 2012 at 11:24 PM, Liron Shiri <lirons(at)checkpoint(dot)com> wrote:
> There were no "hot standby" configuration, but the DB has start grow fast after restoring from a base backup as described in http://www.postgresql.org/docs/8.3/static/continuous-archiving.html#BACKUP-BASE-BACKUP

Very interesting. That is more or less the same concept, but it might
eliminate some variables. What's your workload on the bloaty toast
table? Mine is per the bug report, which is repeated concatenation of
strings.

> The DB has been growing for a while, and now it seems to become stable after adjusting the autovacuum cost parameters to be more aggressive.

My database has taken many days (over a week) to stabilize. I was
about to write that it never stops growing (we'd eventually have to
VACUUM FULL or do a column rotation), but that is not true. This
graph is a bit spotty for unrelated reasons, but here's something like
what I'm seeing:

http://i.imgur.com/tbj1n.png

The standby promotion sticks out quite a bit. I wonder if the
original huge size is not the result of a huge delete (which I
surmised) but rather another standby promotion. We tend to do that a
lot here.

> The DB version is 8.3.7.
>
> Do you think it might be the same issue?
> What can we do in order to decrease DB size?

One weakness of Postgres is can't really debloat online or
incrementally yet, but luckily your table is quite small: you can use
"CLUSTER" to lock and re-write the table, which will then be small.
Do not use VACUUM FULL on this old release, but for future reference,
VACUUM FULL has been made more like CLUSTER in newer releases anyway,
and one can use that in the future. Both of these do table rewrites
of the live data

--
fdr

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Daniel Farina 2012-08-28 08:59:15 Re: Investigating the reason for a very big TOAST table size
Previous Message Mathieu De Zutter 2012-08-28 07:39:26 pg_trgm and slow bitmap index scan plan