Question

I am running a very expensive query that I executed via pgAdmin 4 which is installed on my laptop. I am executing the query on a cloud server.

The message that I see is 'Waiting for query execution to complete...'

If I shut my laptop off right now, will the query continue to run until completed?

Thanks.

Was it helpful?

Solution

Probably not.

The server will detect that the TCP connection has been closed sooner or later and then try to cancel the query.

You may have success with suspend instead of shutdown, but it's not guaranteed to work.

Your best option is to connect to the server (or to some other always-on server) and run the query there using the psql command-line in a tmux, or screen session etc.

PgAgent may also be worth considering.

OTHER TIPS

The server will not detect that the connection has been broken until it tries to send back data to the client and discovers the client has disappeared. If the query sends no data until the very end, the query will run to completion.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top