script to drop and build all indexes in database

Поиск
Список
Период
Сортировка
От Campbell, Lance
Тема script to drop and build all indexes in database
Дата
Msg-id B75CD08C73BD3543B97E4EF3964B7D701F65430B@CITESMBX1.ad.uillinois.edu
обсуждение исходный текст
Ответы Re: script to drop and build all indexes in database  (bricklen <bricklen@gmail.com>)
Список pgsql-admin

PostgreSQL:9.2

OS: Linux

Does someone have a script that they would be willing to share that would:

1)      Create a list of all indexes within database X

2)      Loop for each index in list

3)      Inside loop drop index then create index with concurrently

4)      End loop

5)      Exit script

I have been using the command, “REINDEX DATABASE somedatabename” ,  to rebuild all of my indexes on a production database used for web applications.  But I believe while this is running late at night users are experiencing issues when they submit web requests that would write to tables that are being reindexed.  I discovered that reindex does not allow for the use of concurrently as a parameter. 

 

Suggestion:

It seems like it would be a good idea to add the parameter of concurrently to reindex.   

 

 

Thanks so much,

 

Lance Campbell

Software Architect

Web Services at Public Affairs

217-333-0382

University of Illinois at Urbana-Champaign logo

 

 

Вложения

В списке pgsql-admin по дате отправления:

Предыдущее
От: Jeni Fifrick
Дата:
Сообщение: Re: AUTOVACUUM after purging a lot of records
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: AUTOVACUUM after purging a lot of records