Skip site navigation (1) Skip section navigation (2)

Re: [ADMIN] reclaiming disk space after major updates

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: [ADMIN] reclaiming disk space after major updates
Date: 2007-06-08 15:10:57
Message-ID: 20070608151057.GG17144@phlogiston.dyndns.org (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-performance
On Fri, Jun 08, 2007 at 08:29:24AM -0600, Dan Harris wrote:
> 
> One more point in my original post.. For my own education, why does VACUUM 
> FULL prevent reads to a table when running (I'm sure there's a good 
> reason)?  I can certainly understand blocking writes, but if I could still 
> read from it, I'd have no problems at all!

It has to take an exclusive lock, because it actually moves the bits
around on disk.  Since your SELECT query could be asking for data
that is actually in-flight, you lose.  This is conceptually similar
to the way defrag works on old FAT-type filesystems: if you used one,
you'll remember that when you were defragging your disk, if you did
anything else on that disk the defrag would keep restarting.  This
was because the OS was trying to move bits around, and when you did
stuff, you screwed up its optimization.  The database works
differently, by taking an exclusive lock, but the basic conceptual
problem is the same.

A

-- 
Andrew Sullivan  | ajs(at)crankycanuck(dot)ca
Unfortunately reformatting the Internet is a little more painful 
than reformatting your hard drive when it gets out of whack.
		--Scott Morris

In response to

pgsql-performance by date

Next:From: Chris HooverDate: 2007-06-08 15:44:16
Subject: Please help me understand these numbers
Previous:From: Dan HarrisDate: 2007-06-08 14:29:24
Subject: Re: [ADMIN] reclaiming disk space after major updates

pgsql-admin by date

Next:From: Charles.HouDate: 2007-06-08 15:20:36
Subject: Re: the right time to vacuum database?
Previous:From: Dan HarrisDate: 2007-06-08 14:29:24
Subject: Re: [ADMIN] reclaiming disk space after major updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group