X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C8D05D1B558 for ; Thu, 11 Sep 2003 21:02:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 13266-04 for ; Thu, 11 Sep 2003 18:02:30 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id C5C26D1B52B for ; Thu, 11 Sep 2003 18:02:27 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h8BL2RAn001381; Thu, 11 Sep 2003 17:02:27 -0400 (EDT) To: "scott.marlowe" Cc: Chris Miles , pgsql-admin@postgresql.org Subject: Re: Does VACUUM ever free up any disk space? In-reply-to: References: Comments: In-reply-to "scott.marlowe" message dated "Thu, 11 Sep 2003 13:18:04 -0600" Date: Thu, 11 Sep 2003 17:02:27 -0400 Message-ID: <1380.1063314147@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/193 X-Sequence-Number: 10281 "scott.marlowe" 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