Re: How to stop a query

From: "Martin French" <Martin(dot)French(at)romaxtech(dot)com>
To: younus <younus(dot)essahli(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org,pgsql-general-owner(at)postgresql(dot)org
Subject: Re: How to stop a query
Date: 2012-07-20 06:59:02
Message-ID: OF2B60335A.61899551-ON80257A41.0025970A-80257A41.00265D27@LocalDomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html><body><p><font size="2" face="sans-serif">As Scott mentioned, kill -9 on a Postgres process is not a wise idea on a Postgres process.</font><br><br><font size="2" face="sans-serif">If you query is coming from another application, then terminating that application with a kill -9 *may* work, but is, as scott says, a last resort</font><br><br><font size="2" face="sans-serif">I tend to use kill -TERM (15) to disconnect the client, which gives the log message &quot; terminating connection due to administrator command&quot;</font><br><font size="2" face="sans-serif">kill -INT (2) gives the &quot;cancelling statement due to user request&quot; and does not disconnect the client.</font><br><br><font size="2" face="sans-serif">So it depends on what you want to do.</font><br><br><font size="2" face="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/postgresql stop or a pg_ctl stop -m f. then restart the server.</font><br><br><font size="2" face="sans-serif">Only if that does not work will i consider killing using a -9.</font><br><br><font size="2" face="sans-serif">Cheers</font><br><br><tt><font size="2">pgsql-general-owner(at)postgresql(dot)org wrote on 19/07/2012 17:25:57:<br><br>&gt; From: younus &lt;younus(dot)essahli(at)gmail(dot)com&gt;</font></tt><br><tt><font size="2">&gt; To: pgsql-general(at)postgresql(dot)org, </font></tt><br><tt><font size="2">&gt; Date: 19/07/2012 20:30</font></tt><br><tt><font size="2">&gt; Subject: Re: [GENERAL] How to stop a query</font></tt><br><tt><font size="2">&gt; Sent by: pgsql-general-owner(at)postgresql(dot)org</font></tt><br><tt><font size="2">&gt; <br>&gt; Hi, <br>&gt; <br>&gt; Yes, I'm sure, it's work.<br>&gt; <br>&gt; if you execute query by another program (program java), you must use the<br>&gt; first solution [ps -ef | grep postgres and &nbsp;kill -9 (PID of your query)].<br>&gt; <br>&gt; if you use pgsql terminal and you're connecting with postgres you can use <br>&gt; select procpid, datname, usename, client_addr, &nbsp;current_query from<br>&gt; pg_stat_activity where current_query!='&lt;IDLE&gt;';<br>&gt; SELECT pg_cancel_backend (procpid);<br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; Younus.<br>&gt; <br>&gt; --<br>&gt; View this message in context: <a href="http://postgresql">http://postgresql</a>.<br>&gt; 1045698.n5.nabble.com/How-to-stop-a-query-tp1924086p5717297.html<br>&gt; Sent from the PostgreSQL - general mailing list archive at Nabble.com.<br>&gt; <br>&gt; -- <br>&gt; Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)<br>&gt; To make changes to your subscription:<br>&gt; <a href="http://www.postgresql.org/mailpref/pgsql-general">http://www.postgresql.org/mailpref/pgsql-general</a><br>&gt; <br></font></tt><font face="sans-serif">=============================================

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

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

For other office locations see:
http://www.romaxtech.com/Contact
=================================
===============
E-mail: info(at)romaxtech(dot)com
Website: www.romaxtech.com
=================================

================
Confidentiality Statement
This transmission is for the addressee only and contains information that is confidential and privileged.
Unless you are the named addressee, or authorised to receive it on behalf of the addressee
you may not copy or use it, or disclose it to anyone else.
If you have received this transmission in error please delete from your system and contact the sender. Thank you for your cooperation.
=================================================</font>
</body></html>

Attachment Content-Type Size
unknown_filename text/html 3.6 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-07-20 07:44:18 Re: Problem setting environmental variables for postgresql or plpythonu
Previous Message Mark Wynter 2012-07-20 00:57:26 Problem setting environmental variables for postgresql or plpythonu