Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum) - Mailing list pgsql-general

From Jeff Janes
Subject Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum)
Date
Msg-id CAMkU=1z-PC-O512O=U_MhStKaSMzW9BLeeySZp7wbXDU7enA9A@mail.gmail.com
Whole thread Raw
In response to Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum)  (Lists <lists@benjamindsmith.com>)
Responses Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum)  (Lists <lists@benjamindsmith.com>)
List pgsql-general
On Fri, Nov 9, 2012 at 4:28 PM, Lists <lists@benjamindsmith.com> wrote:


...

> 3) For each of the tables from #2, run the commands
> REINDEX TABLE $table;
> VACUUM FULL ANALYZE $table;
>
> The end result is a squeaky-clean database server with expected disk usage.
>
> NOTES:
...
>
>
> 2) It was sheer chance that I discovered the need to reindex prior to vacuum
> in order to get the disk space back.

As of 9.0, a "vacuum full" inherently does a reindex, so doing an
explicit one is neither necessary nor beneficial.

I don't know if your discovery is based on a non-full vacuum, or on an
older server.


> 5) I don't yet know if the "full" option for the vacuum is necessary to free
> up all space. I will experiment with this and post results if useful.

The answer to this is mostly non-deterministic.  non-full vacuum can
only free space from the "end" of the table.

If all of your long-lived objects were created before pg_attribute got
bloated and so the bloat was due only to short-lived objects, then
non-full vacuum (if run often enough) should eventually be able to
return that space as the short-lived objects near the end start to go
away.  However, if even a single long-live object finds itself at the
end of the table, then only a vacuum full will ever be able to reclaim
that space.

Cheers,

Jeff


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum)
Next
From: Scott Marlowe
Date:
Subject: Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum)