Home > Software engineering >  Run postgres index creation in background
Run postgres index creation in background

Time:11-19

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.

CodePudding user response:

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.

  • Related