Re: Options for more aggressive space reclamation in vacuuming?

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Options for more aggressive space reclamation in vacuuming?
Date: 2023-05-14 18:32:10
Message-ID: CAMkU=1zaXmEtvFyt-hGyGvryj0K5OQyR880BTnhw47ux8ZeiNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sun, May 14, 2023 at 1:46 PM Wells Oliver <wells(dot)oliver(at)gmail(dot)com> wrote:

> Noticed over the last few days how much more space VACUUM FULL reclaims
> (for obvious reasons) and I am wondering if there are any solutions for a
> more fruitful VACUUM without the locks of FULL?
>

There are lots of theories which are all compatible with the minimal amount
of info given here. If the space is freed from the indexes, then just
reindexing (which can be done concurrently in recent versions) could
reclaim the space. If it is from the table itself then something like
pg_squeeze (https://github.com/cybertec-postgresql/pg_squeeze/) might help.
Or you can implement your own squeezing, by using a CTE with a ctid scan to
delete tuples from the end of the table and reinsert them in the front,
then use regular vacuum to truncate the now-free space off the end of the
table.

I would think the more fruitful VACUUM would be to prevent the bloat from
occuring in the first place but without knowing the root cause I can't
offer anything but platitudes there.

Cheers,

Jeff

>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Wells Oliver 2023-05-14 21:02:26 Re: Options for more aggressive space reclamation in vacuuming?
Previous Message Jeff Janes 2023-05-14 18:08:01 Re: Unexplained rapid growth in memory usage of idle backends