Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Run postgres index creation in background

I want to run index creation without any need for the client to remain connected to the server.
I found this thread, which mentions that the only way to create index in background is
psql -c "CREATE INDEX index_name ON table(column)" &

But this still requires the client to stay connected with the server. Since this is a old thread, would like to know if any new feature has been introduced in postgres which allows such a scenario.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

No, this is still not possible.

I would run the command on the server itself, so there can be no network problem:

nohup psql -c "CREATE INDEX CONCURRENTLY ..." </dev/zero >/dev/null 2>&1 &

Then you can disconnect the session, and the command will keep running.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading