pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>
Cc: PostgreSQL Administrators Mailing List <pgsql-admin@postgresql.org>
Subject: Re: VACUUM/VACUUM FULL/REINDEX
Date: Fri, 01 Aug 2003 10:29:55 -0400
Message-ID: <7815.1059748195@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.50.0308010955350.6415-100000@short.lancs.ac.uk>
References: <Pine.LNX.4.50.0308010955350.6415-100000@short.lancs.ac.uk>

Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk> writes:
> I'm a little confused about comments I've seen on this list - a VACUUM
> is not enough, clearly, to maintain a trim, efficient DB. People have
> mentioned that REINDEX is also needed periodically.

If you have an index whose range of values continually shifts (for
example, a timestamp or serial-number column) then you will probably
need to REINDEX it every so often to reclaim empty space in the index.
This is at least partially fixed for 7.4, but it's necessary in all
prior versions.  The problem is that VACUUM had no mechanism to reclaim
btree pages that become totally empty because there's no longer any data
in the range of key values they represent.

When the indexed column's statistics aren't changing much over time,
I wouldn't think you'd need to do routine reindexing --- just keeping
after the table with VACUUM ought to be enough.

			regards, tom lane



view thread (2+ messages)

Message-ID: <7815.1059748195@sss.pgh.pa.us>
Permalink:  ../7815.1059748195@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7815.1059748195@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, s.barnett-cormack@lancaster.ac.uk
  Subject: Re: VACUUM/VACUUM FULL/REINDEX
  In-Reply-To: <7815.1059748195@sss.pgh.pa.us>
  References: <Pine.LNX.4.50.0308010955350.6415-100000@short.lancs.ac.uk> <7815.1059748195@sss.pgh.pa.us>

* 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