pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Geoff Tolley <geoff@polimetrix.com>
To: Nick Urbanik <nicku@nicku.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: How overcome wait for vacuum full?
Date: Tue, 15 May 2007 16:11:32 -0700
Message-ID: <464A3E24.6060204@polimetrix.com> (raw)
In-Reply-To: <20070515221356.GG5264@nicku.org>
References: <20070515221356.GG5264@nicku.org>

Nick Urbanik wrote:

> I am running a full vacuum on a database.  It's taking longer than I
> hoped.  In particular, the vacuum still hasn't reached the table that
> will benefit most from the vacuum.
> 
> Can I move the existing table to a backup, make a copy of the table
> back to its original name, restart the application, and run the vacuum
> on the backup?  Or can I reclaim the disk space by dropping the
> original after making a copy?
> 
> If I can, without losing data, what is the best way to do that?
> I am reaching the end of the period when this database application can
> be disabled.

If you're waiting on vacuum to get around to the one table, you can run 
VACUUM FULL <tablename> instead.

Personally I've found that dropping indices (including the PK), then vacuum 
full, then recreating indices can be an awful lot faster than just leaving 
vacuum full to its own devices.

Yes you ought to be able to reclaim disk space by the copy/drop 
original/rename procedure, but that gets hard to manage if you have 
triggers or foreign keys on the table in question. You might want to use 
CREATE TABLE table_copy (LIKE orig_table) to preserve column defaults if 
you go down that path.

HTH,
Geoff



view thread (12+ messages)  latest in thread

Message-ID: <464A3E24.6060204@polimetrix.com>
Permalink:  ../464A3E24.6060204@polimetrix.com/
Also on:    postgresql.org/message-id/464A3E24.6060204@polimetrix.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: geoff@polimetrix.com, nicku@nicku.org
  Subject: Re: How overcome wait for vacuum full?
  In-Reply-To: <464A3E24.6060204@polimetrix.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox