pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew G. Hammond <drew@xyzzy.dhs.org>
To: Marc Spitzer <marc@oscar.eng.cv.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: How do I vacuum safely?  And how often should I reindex
Date: 17 Dec 2001 20:02:42 -0500
Message-ID: <1008637363.4653.2.camel@xyzzy> (raw)
In-Reply-To: <slrna1sahp.2292.marc@oscar.eng.cv.net>
References: <slrna1sahp.2292.marc@oscar.eng.cv.net>

On Mon, 2001-12-17 at 12:25, Marc Spitzer wrote:

> I have some questions about vaccum analize, and here they are:
> 
> 1: to vaccume analize a db I just vaccume analize the tables
>    one at a time

Or you could run it on the entire database by not specifying a table.

> 2: no reads or writes happen durring the vacuum 

The vacuum it'self does quite a bit of re-organizing.

> 3: does vacuum wait to aquire the lock or just fail, is 
>    it nessarsary to get the lock programaticly and then
>    turn it loos oe will it take care of it self.

According to the docs, VACUUM aquires an ACCESS EXCLUSIVE LOCK.  You can
see this out yourself by firing up two psql sessions and in the first:
BEGIN; LOCK foo; In the second, VACUUM foo; it'll block waiting for a
lock on table foo.  Go back to the first and COMMIT, and the second will
immediately start vacuuming.  However this is slated to change in 7.2

> 1: how do I figure out how much space is wasted in my indexs
>    and primary keys?  Now I just keep an eye on disk usage,
>    is there a better way?

Indices are wasted only if you never use them.  Otherwise they make a
pretty huge difference.  Given the price of GB's recently, the better
way is to throw hardware at it.

> 2: how often should I reindex my db, are there any standards
>    or accepted practices out there

I recreate my indices every week, or after any extensive updates or
deletes.  Again, I believe that 7.2 has some new stuff to deal with this
issue.

> and how will 7.2 be different, I remember a background vacuum
> being discused, what other great things are there waiting in
> the wings

Er... RTFM: http://developer.postgresql.org/todo.php  stuff that's
slated for 7.2 has a - in front of it.

-- 
Andrew G. Hammond     mailto:drew@xyzzy.dhs.org  
http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F                 
613-389-5481
5CD3 62B0 254B DEB1 86E0  8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me

view thread (4+ messages)  latest in thread

Message-ID: <1008637363.4653.2.camel@xyzzy>
Permalink:  ../1008637363.4653.2.camel@xyzzy/
Also on:    postgresql.org/message-id/1008637363.4653.2.camel@xyzzy

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: drew@xyzzy.dhs.org, marc@oscar.eng.cv.net
  Subject: Re: How do I vacuum safely?  And how often should I reindex
  In-Reply-To: <1008637363.4653.2.camel@xyzzy>
  References: <slrna1sahp.2292.marc@oscar.eng.cv.net> <1008637363.4653.2.camel@xyzzy>

* 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