From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Lists <lists(at)benjamindsmith(dot)com> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum) |
Date: | 2012-11-10 22:21:47 |
Message-ID: | CAMkU=1z-PC-O512O=U_MhStKaSMzW9BLeeySZp7wbXDU7enA9A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Nov 9, 2012 at 4:28 PM, Lists <lists(at)benjamindsmith(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2012-11-10 22:23:45 | Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum) |
Previous Message | Adrian Klaver | 2012-11-10 22:20:59 | Re: Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum) |