pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Browne <cbbrowne@acm.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: REINDEX DATABASE
Date: Thu, 28 Jul 2005 01:08:55 -0400
Message-ID: <20367.1122527335@sss.pgh.pa.us> (raw)
In-Reply-To: <608xzs1d1n.fsf@dba2.int.libertyrms.com>
References: <60pst51ocd.fsf@dba2.int.libertyrms.com>
	<Pine.LNX.4.44.0507270856070.32187-100000@matrix.gatewaynet.com>
	<608xzs1d1n.fsf@dba2.int.libertyrms.com>

Chris Browne <cbbrowne@acm.org> writes:
> achill@matrix.gatewaynet.com (Achilleus Mantzios) writes:
>> I am just saying that the common saying "reindex is not needed for
>> 7.4+" maybe is not true in all circumstances.

> ...

> In versions earlier than 7.4, running a REINDEX periodically was
> *essential* if you had update patterns consistent with the (remarkably
> common) scenario described above.

> This reason to reindex (which was the main reason we required
> reindexing when using 7.2) has been resolved and gone away in 7.4.

> There may be other factors that could mandate REINDEX; as far as I can
> tell, the main such factor that remains would be where a table sees
> enormous numbers of updates but is not VACUUMed often enough.

I think the case that 7.4 resolved is where you have a
continually-moving window of index values; for example, an index on a
timestamp column in a table where you delete entries older than 30 days.
Before 7.4, index pages for timestamps older than 30 days would become
empty and then just sit there, with no other way to reclaim them than
REINDEX.

The case that isn't resolved yet is where you have a usage pattern that
causes a lot of index pages to become mostly but not entirely empty.
For example, your entries are timestamps, and you have a cleanup process
that removes just 99 out of every 100 successive entries.  This'll leave
you with just a couple of index entries per page, which might not be
infinite bloat but it's surely not too efficient.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <20367.1122527335@sss.pgh.pa.us>
Permalink:  ../20367.1122527335@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20367.1122527335@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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cbbrowne@acm.org
  Subject: Re: REINDEX DATABASE
  In-Reply-To: <20367.1122527335@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