Re: Does VACUUM ever free up any disk space?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Chris Miles <chris_pg002(at)psychofx(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Does VACUUM ever free up any disk space?
Date: 2003-09-11 21:02:27
Message-ID: 1380.1063314147@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
> On Thu, 11 Sep 2003, Chris Miles wrote:
>> I've read a lot where people recommend using VACUUM FULL
>> to free up disk space, especially after many updates/inserts.

> A regular vacuum since 7.2 never actually frees up space, it simply marks
> the space in the file as available for reuse. Note that in many
> circumstances this is actually better than freeing up the space, as it
> allows the database to store date without having to extend and possibly
> fragment the table.

Regular vacuum *will* shorten the table's file if (a) there are some
completely-empty pages at the end, and (b) it can get an exclusive lock
on the table without blocking. This might be a relatively rare
condition in a heavily-used table. But "never actually frees up space"
is incorrect.

You're correct that regular vacuum is designed around the idea of
maintaining a steady-state file size rather than trying very hard to
give space back to the OS.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Biagioni 2003-09-11 21:11:21 Cross-DB linking?
Previous Message Peralta Miguel-MPERALT1 2003-09-11 19:35:56 unsubscribe