From: | Niels Kristian Schjødt <nielskristian(at)autouncle(dot)com> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | "pgsql-performance(at)postgresql(dot)org list" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Best practice when reindexing in production |
Date: | 2013-05-29 12:41:55 |
Message-ID: | A0841319-1436-48F0-BBEE-6D260493C369@autouncle.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Thanks
Can you think of a way to select all the indexes programmatically from a table and run CREATE INDEX CONCURRENTLY for each of them, so that I don't have to hardcode every index name + create statement ?
Den 29/05/2013 kl. 14.26 skrev Magnus Hagander <magnus(at)hagander(dot)net>:
> On Wed, May 29, 2013 at 8:24 AM, Niels Kristian Schjødt
> <nielskristian(at)autouncle(dot)com> wrote:
>> Hi,
>>
>> I have a database with quite some data (millions of rows), that is heavily updated all the time. Once a day I would like to reindex my database (and maybe re cluster it - don't know if that's worth it yet?). I need the database to be usable while doing this (both read and write). I see that there is no way to REINDEX CONCURRENTLY - So what approach would you suggest that I take on this?
>
> If you have the diskspaec, it's generally a good idea to do a CREATE
> INDEX CONCURRENTLY, and then rename the new one into place (typically
> in a transaction). (If your app, documentation or dba doesn't mind the
> index changing names, you don't need to rename of course, you can just
> drop the old one).
>
>
> --
> Magnus Hagander
> Me: http://www.hagander.net/
> Work: http://www.redpill-linpro.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2013-05-29 13:08:40 | Re: Best practice when reindexing in production |
Previous Message | Niels Kristian Schjødt | 2013-05-29 12:38:38 | Re: Best practice when reindexing in production |