| From: | Magnus Hagander <magnus(at)hagander(dot)net> |
|---|---|
| To: | Niels Kristian Schjødt <nielskristian(at)autouncle(dot)com> |
| 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 13:08:40 |
| Message-ID: | CABUevEw3FL9y9z1TEyq0LiSYhwwdGJ_mzNURpOORaqk1Lz_vuQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On Wed, May 29, 2013 at 8:41 AM, Niels Kristian Schjødt
<nielskristian(at)autouncle(dot)com> wrote:
> 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 ?
You can use something like SELECT pg_get_indexdef(indexrelid) FROM
pg_index. You will need to filter it not to include system indexes,
toast, etc, and then insert the CONCURRENCY part, but it should give
you a good startingpoint.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus de Oliveira | 2013-05-29 13:12:18 | Re: Best practice when reindexing in production |
| Previous Message | Niels Kristian Schjødt | 2013-05-29 12:41:55 | Re: Best practice when reindexing in production |