Cleanly cancel a query.

Started by Dennis Muhlesteinalmost 25 years ago4 messagesgeneral
Jump to latest
#1Dennis Muhlestein
dennis@zserve.com

If I have a database running, and I see that
there is a postmaster process taking 99.9% cpu.

ie, a very large insert query.

Is there a way to cleanly shut down that query from the client or admin
side?

-Thanks

#2Thalis A. Kalfigopoulos
thalis@cs.pitt.edu
In reply to: Dennis Muhlestein (#1)
Re: Cleanly cancel a query.

You can kill -TERM the postmaster that is executing the particular query.

cheers,
t.

On Fri, 8 Jun 2001, Dennis wrote:

Show quoted text

If I have a database running, and I see that
there is a postmaster process taking 99.9% cpu.

ie, a very large insert query.

Is there a way to cleanly shut down that query from the client or admin
side?

-Thanks

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#3Thalis A. Kalfigopoulos
thalis@cs.pitt.edu
In reply to: Thalis A. Kalfigopoulos (#2)
Re: Cleanly cancel a query.

To be more precise, if by "a very large insert" you mean an import of a large data file via COPY, then it is fully transactional i.e. if you kill -TERM the corresponding postmaster, it'll be like the insert never took place.
If you mean multiple INSERTs in a transaction block then again the same.
But if it is a text file with multiple INSERTs just by themselves, I'd guess killing the postmaster would live you with a table only half-full.

cheers,
thalis

On Fri, 8 Jun 2001, Thalis A. Kalfigopoulos wrote:

Show quoted text

You can kill -TERM the postmaster that is executing the particular query.

cheers,
t.

On Fri, 8 Jun 2001, Dennis wrote:

If I have a database running, and I see that
there is a postmaster process taking 99.9% cpu.

ie, a very large insert query.

Is there a way to cleanly shut down that query from the client or admin
side?

-Thanks

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dennis Muhlestein (#1)
Re: Cleanly cancel a query.

Dennis <dennis@zserve.com> writes:

Is there a way to cleanly shut down that query from the client or admin
side?

From the client: send a query-cancel request (for example, typing ^C
in psql usually does this).

From the admin: send a SIGINT to the backend running the query, which
has the same effect as a query-cancel request.

regards, tom lane