PostgreSQL – Execute Query from psql Without Waiting for Result

postgresqlpsql

My query (to create a new table from existing table) takes a very long time. So I've set up a remote database in my office – more RAM there.

I can connect to my database from home as usual with psql.

How can I tell the remote server to execute my query from the terminal without having to wait for a response?

(postgresql-9.2 , linux enviroment)

Edit:
I'm open to other solutions, it's not necessary to use psql

Best Answer

Since you state that you are open to other solutions I might suggest looking at terminal multiplexers such as screen or tmux. In my opinion tmux is a better choice due to its unique name (easier to get relevant hits in search engines).

Essentially this kind of software allows you to detach from a shell and later resume the session.