Re: When/if to Reindex

From: "Steven Flatt" <steven(dot)flatt(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Mark Kirkwood" <markir(at)paradise(dot)net(dot)nz>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Bill Moran" <wmoran(at)collaborativefusion(dot)com>, "Vivek Khera" <vivek(at)khera(dot)org>, "Pgsql performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: When/if to Reindex
Date: 2007-08-24 17:49:01
Message-ID: 357fa7590708241049i50e815fcj2b5c7cd49d7195a2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 8/24/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> You might be able to work around it for now by faking such a reindex
> "by hand"; that is, create a duplicate new index under a different
> name using CREATE INDEX CONCURRENTLY, then exclusive-lock the table
> for just long enough to drop the old index and rename the new one
> to match.

This is a good suggestion, one that we had thought of earlier. Looks like
it might be time to try it out and observe system impact.

> It's probably worth asking also how badly you really need routine
> reindexing. Are you certain your app still needs that with 8.2,
> or is it a hangover from a few releases back? Could more aggressive
> (auto)vacuuming provide a better solution?

Routine reindexing was added (recently, since moving to 8.2) as more of an
optimization than a necessity. If the idea above doesn't work for us or
causes locking issues, then we could always do away with the periodic
reindexing. That would be unfortunate, because reindexing serves to be
quite a nice optimization for us. We've observed up to 40% space savings
(after setting the fillfactor to 100, then reindexing) along with general
improvement in read performance (although hard to quantify).

As mentioned earlier in this thread, we're only reindexing insert-only
partitioned tables, once they're fully loaded.

Thanks for your help.

Steve

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Kempter 2007-08-24 19:57:23 significant vacuum issues - looking for suggestions
Previous Message Tom Lane 2007-08-24 17:28:55 Re: When/if to Reindex