Re: Reindexing primary keys without locking - Mailing list pgsql-admin

From Stuart Bishop
Subject Re: Reindexing primary keys without locking
Date
Msg-id BANLkTim8drpsdqRrmDspsOLA1a7fTJyc7g@mail.gmail.com
Whole thread Raw
In response to Reindexing primary keys without locking  (Glyn Astill <glynastill@yahoo.co.uk>)
Responses Re: Reindexing primary keys without locking  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-admin
On Wed, Jun 1, 2011 at 7:38 PM, Glyn Astill <glynastill@yahoo.co.uk> wrote:
> Hi Guys,
> Does anyone know of any tricks to replace primary key indexes without using
> reindex? Or any other method that will not lock the table for an extended
> amount of time on 8.4?
> I've got a bloated primary key index on a table and I'd like to try and
> clean it up without downtime.

If you are brave, http://pqxx.org/development/libpqxx/wiki/PrimaryKeyTransplant

If you go this route, ensure you have a test environment and ensure
you can dump and restore your db schema after applying the patch, and
that the diff of the before and after schemas checks out. If you screw
up, you can end up with crazy things like multiple indexes with the
same name and other stuff making your database unrecoverable.

--
Stuart Bishop <stuart@stuartbishop.net>
http://www.stuartbishop.net/

pgsql-admin by date:

Previous
From: M C
Date:
Subject: Hello
Next
From: Simon Riggs
Date:
Subject: Re: Reindexing primary keys without locking