Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a REINDEX but it takes long time and still working. The application using the DB is not responding right now. Is there a safe way to stop it and do it another time? PostgreSQL version is 8.4.

share|improve this question
I would not expect any problem stopping a REINDEX. Once it started, the index would be unusable until REINDEX successfully would finish. But I'm concerned more with why do you need reindexing? Anyhow, dropping the index and building it with CREATE INDEX CONCURRENTLY wouldn't block the normal operation of your system. – dezso Feb 14 '13 at 10:30
up vote 4 down vote accepted

Yes, it's safe. Might take a while, though.

In future you might want to use "CREATE INDEX CONCURRENTLY", like dezso suggested, but first create new index, and then drop old one.

share|improve this answer
is there any script to automatically do the job ? as simple as just create a cron for it ? – Omid Kosari Feb 14 '13 at 10:46
Not that I know of, but since it's just two commands, you can write the commands in "recreate.sql" file, and now you have a script. – user1593 Feb 14 '13 at 10:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.