Re: How to stop a query - Mailing list pgsql-general

From Martin French
Subject Re: How to stop a query
Date
Msg-id OF2B60335A.61899551-ON80257A41.0025970A-80257A41.00265D27@LocalDomain
Whole thread Raw
In response to Re: How to stop a query  (younus <younus.essahli@gmail.com>)
Responses autovaccum task got cancelled
List pgsql-general
As Scott mentioned, kil=
l -9 on a Postgres process is not a wise idea on a Postgres process.=
If you query is coming from an=
other application, then terminating that application with a kill -9 *may* w=
ork, but is, as scott says, a last resort<font size=3D"2" fa=
ce=3D"sans-serif">I tend to use kill -TERM (15) to disconnect the client, w=
hich gives the log message " terminating connection due to administrat=
or command"kill -INT (=
2) gives the "cancelling statement due to user request" and does =
not disconnect the client.<font size=3D"2" face=3D"sans-seri=
f">So it depends on what you want to do.<font size=3D"2" fac=
e=3D"sans-serif">If i have a runaway query (not so common on 9.1 now), Then=
 i'll try the above, and if they don't work, then i'll try an /etc/init.d/p=
ostgresql stop or a pg_ctl stop -m f. then restart the server.<b=
r>Only if that does not work will i co=
nsider killing using a -9.<font size=3D"2" face=3D"sans-seri=
f">Cheerspgsql-general-owner@postgresql=
.org wrote on 19/07/2012 17:25:57:> From: younus <younus.essa=
hli@gmail.com>> To: pgsql-genera=
l@postgresql.org, > Date: 19/07/201=
2 20:30> Subject: Re: [GENERAL] How=
 to stop a query> Sent by: pgsql-ge=
neral-owner@postgresql.org> >=
; Hi, > > Yes, I'm sure, it's work.> > if you e=
xecute query by another program (program java), you must use the> fi=
rst solution [ps -ef | grep postgres and  kill -9 (PID of your query)]=
.> > if you use pgsql terminal and you're connecting with pos=
tgres you can use > select procpid, datname, usename, client_addr, &=
nbsp;current_query from> pg_stat_activity where current_query!=3D'&l=
t;IDLE>';> SELECT pg_cancel_backend (procpid);> > <=
br>> > > Younus.> > --> View this mes=
sage in context: http://postgresql.&g=
t; 1045698.n5.nabble.com/How-to-stop-a-query-tp1924086p5717297.html>=
 Sent from the PostgreSQL - general mailing list archive at Nabble.com.=
> > -- > Sent via pgsql-general mailing list (pgsql-genera=
l@postgresql.org)> To make changes to your subscription:> <a =
href=3D"http://www.postgresql.org/mailpref/pgsql-general">http://www.postgr=
esql.org/mailpref/pgsql-general> <font face=3D"s=
ans-serif">=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Romax Technology Limited
Rutherford House
Nottingham Science & Technology Park
Nottingham,=20
NG7 2PZ
England

Telephone numbers:
+44 (0)115 951 88 00 (main)

For other office locations see:
http://www.romaxtech.com/Contact
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
E-mail: info@romaxtech.com
Website: www.romaxtech.com
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Confidentiality Statement
This transmission is for the addressee only and contains information that i=
s confidential and privileged.
Unless you are the named addressee, or authorised to receive it on behalf o=
f the addressee=20
you may not copy or use it, or disclose it to anyone else.=20
If you have received this transmission in error please delete from your sys=
tem and contact the sender. Thank you for your cooperation.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</f=
ont>

pgsql-general by date:

Previous
From: Nick
Date:
Subject: Re: High CPU on read-only streaming replication server
Next
From: "Albe Laurenz"
Date:
Subject: Re: Problem setting environmental variables for postgresql or plpythonu