简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM