Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wes <wespvp(at)msg(dot)bt(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX
Date: 2008-01-24 18:48:30
Message-ID: 13705.1201200510@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Wes <wespvp(at)msg(dot)bt(dot)com> writes:
> I'm running 8.1.4. Assume I have exclusive access to the DB.

You really ought to update to 8.1.something-newer, but I digress.

> 1. Is there any advantage to doing the DROP/CREATE over just doing a REINDEX
> DATABASE.

No, not if you don't mind exclusive locks. DROP together with CREATE
INDEX CONCURRENTLY might be nicer if you were trying to do this without
completely shutting down the DB, but if you aren't running normal
operations then just use REINDEX.

> 2. I'm assuming REINDEX would avoid the time involved in recreating the
> foreign key constraints?

Right, that's one reason to do it that way.

> 3. With a REINDEX DATABASE, how can I monitor progress?

It should give you a NOTICE after each table.

BTW, what have you got maintenance_work_mem set to?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2008-01-24 18:55:34 Re: changing the default directory
Previous Message Dominique Bessette - Halsema 2008-01-24 18:36:14 unique constraint

Browse pgsql-hackers by date

  From Date Subject
Next Message Wes 2008-01-24 19:35:00 Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX
Previous Message Wes 2008-01-24 16:41:46 REINDEX on large DB vs. DROP INDEX/CREATE INDEX