From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Kristjan Mustkivi <sonicmonkey@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: TOAST table size in bytes growing despite working autovacuum
Date: Mon, 15 Jun 2020 15:37:41 +0200
Message-ID: <78fa342abe358a96601c675729dd1eff0fe5481d.camel@cybertec.at> (raw)
In-Reply-To: <CAOQPKauXDm905pgx7ei0ZKW=dBWWCFX1uJJgKSnwKxZ9tLN7KA@mail.gmail.com>
References: <CAOQPKasgHoNpNZqjAfad10xQ5v9niANVXFZGhp=Q+NLwy1y3kw@mail.gmail.com>
<d80282fda72af6ff87fb9304e21e270b155e19f7.camel@cybertec.at>
<CAOQPKauXDm905pgx7ei0ZKW=dBWWCFX1uJJgKSnwKxZ9tLN7KA@mail.gmail.com>
On Mon, 2020-06-15 at 13:47 +0300, Kristjan Mustkivi wrote:
> Still, pgstattuple reveals that the table size is 715MB while live
> tuple len is just 39MB and 94% of the table is vacant. I do not have
> much experience in interpreting this but it would seem that it is
> still getting bloated. Should the autovacuum be made even more
> aggressive? E.g toast.autovacuum_vacuum_scale_factor=0.01 instead of
> 0.05 and tweaked further when necessary until the size stabilizes
> (more precisely pgstattuple will reflect the bloat to be under
> control):
>
> SELECT * FROM pgstattuple('pg_toast.pg_toast_293406');
> ─[ RECORD 1 ]──────┬──────────
> table_len │ 715776000
> tuple_count │ 25545
> tuple_len │ 39241366
> tuple_percent │ 5.48
> dead_tuple_count │ 1116
> dead_tuple_len │ 1930508
> dead_tuple_percent │ 0.27
> free_space │ 669701052
> free_percent │ 93.56
Indeed, the table is almost entirely air.
You should schedule down time and run a VACUUM (FULL) on that table.
That will rewrite the table and get rid of the bloat.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, sonicmonkey@gmail.com
Subject: Re: TOAST table size in bytes growing despite working autovacuum
In-Reply-To: <78fa342abe358a96601c675729dd1eff0fe5481d.camel@cybertec.at>
References: <CAOQPKasgHoNpNZqjAfad10xQ5v9niANVXFZGhp=Q+NLwy1y3kw@mail.gmail.com> <d80282fda72af6ff87fb9304e21e270b155e19f7.camel@cybertec.at> <CAOQPKauXDm905pgx7ei0ZKW=dBWWCFX1uJJgKSnwKxZ9tLN7KA@mail.gmail.com> <78fa342abe358a96601c675729dd1eff0fe5481d.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox