Re: VACUUM/VACUUM FULL/REINDEX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sam Barnett-Cormack <s(dot)barnett-cormack(at)lancaster(dot)ac(dot)uk>
Cc: PostgreSQL Administrators Mailing List <pgsql-admin(at)postgresql(dot)org>
Subject: Re: VACUUM/VACUUM FULL/REINDEX
Date: 2003-08-01 14:29:55
Message-ID: 7815.1059748195@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Sam Barnett-Cormack <s(dot)barnett-cormack(at)lancaster(dot)ac(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Lamar Owen 2003-08-01 14:35:49 Re: which file of the RH9 jdbc provides Java2 functionality?
Previous Message maillist 2003-08-01 13:55:50 fyi regarding error I've seen posted before