Re: [GENERAL] How to stop a query

2012-07-20 Thread Martin French
As Scott mentioned, kill -9 on a Postgres process is not a wise idea on a Postgres process.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 resortI tend to use kill -TERM (15) to disconnect the client, which gives the log message  terminating connection due to administrator commandkill -INT (2) gives the cancelling statement due to user request and does not disconnect the client.So it depends on what you want to do.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.Only if that does not work will i consider killing using a -9.Cheerspgsql-general-ow...@postgresql.org wrote on 19/07/2012 17:25:57: From: younus younus.essa...@gmail.com To: pgsql-general@postgresql.org,  Date: 19/07/2012 20:30 Subject: Re: [GENERAL] How to stop a query Sent by: pgsql-general-ow...@postgresql.org  Hi,   Yes, I'm sure, it's work.  if you execute query by another program (program java), you must use the first solution [ps -ef | grep postgres and kill -9 (PID of your query)].  if you use pgsql terminal and you're connecting with postgres you can use  select procpid, datname, usename, client_addr, current_query from pg_stat_activity where current_query!='IDLE'; SELECT pg_cancel_backend (procpid); Younus.  -- View this message in context: http://postgresql. 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-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general =

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: i...@romaxtech.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.
=





Re: [GENERAL] How to stop a query

2012-07-19 Thread younus
Hi,

First :
   ps -ef | grep postgres 
and  kill -9 (PID of your query)

Sec :
select procpid, datname, usename, client_addr,  current_query from
pg_stat_activity where current_query!='IDLE';

and 

SELECT pg_cancel_backend(procpid);



younus,

--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/How-to-stop-a-query-tp1924086p5717227.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to stop a query

2012-07-19 Thread Atri Sharma
On Thu, Jul 19, 2012 at 2:47 PM, younus younus.essa...@gmail.com wrote:
 Hi,

 First :
ps -ef | grep postgres
 and  kill -9 (PID of your query)

 Sec :
 select procpid, datname, usename, client_addr,  current_query from
 pg_stat_activity where current_query!='IDLE';

 and

 SELECT pg_cancel_backend(procpid);



 younus,

 --
 View this message in context: 
 http://postgresql.1045698.n5.nabble.com/How-to-stop-a-query-tp1924086p5717227.html
 Sent from the PostgreSQL - general mailing list archive at Nabble.com.

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general

I am not too sure if it is applicable,but have you tried Control-C?

Atri


-- 
Regards,

Atri
l'apprenant

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to stop a query

2012-07-19 Thread younus
Hi, 

Yes, I'm sure, it's work.

if you execute query by another program (program java), you must use the
first solution [ps -ef | grep postgres and  kill -9 (PID of your query)].

if you use pgsql terminal and you're connecting with postgres you can use 
select procpid, datname, usename, client_addr,  current_query from
pg_stat_activity where current_query!='IDLE';
SELECT pg_cancel_backend (procpid);




Younus.

--
View this message in context: 
http://postgresql.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-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to stop a query

2012-07-19 Thread Younus
Hi Scott,

thank you for your comment


2012/7/19 Scott Marlowe scott.marl...@gmail.com

 On Thu, Jul 19, 2012 at 3:17 AM, younus younus.essa...@gmail.com wrote:
  Hi,
 
  First :
 ps -ef | grep postgres
  and  kill -9 (PID of your query)

 NEVER kill -9 a postgres process unless you've exhausted all other
 possibilities, as it forces a restart of all the other backends as
 well.  A plain kill (no -9) is usually all you need, and it doesn't
 cause all the other backends to restart and flush all shared memory.

  Sec :
  select procpid, datname, usename, client_addr,  current_query from
  pg_stat_activity where current_query!='IDLE';
 
  and
 
  SELECT pg_cancel_backend(procpid);

 MUCH better way of doing things.



Re: [GENERAL] How to stop a query

2012-07-19 Thread Scott Marlowe
On Thu, Jul 19, 2012 at 3:17 AM, younus younus.essa...@gmail.com wrote:
 Hi,

 First :
ps -ef | grep postgres
 and  kill -9 (PID of your query)

NEVER kill -9 a postgres process unless you've exhausted all other
possibilities, as it forces a restart of all the other backends as
well.  A plain kill (no -9) is usually all you need, and it doesn't
cause all the other backends to restart and flush all shared memory.

 Sec :
 select procpid, datname, usename, client_addr,  current_query from
 pg_stat_activity where current_query!='IDLE';

 and

 SELECT pg_cancel_backend(procpid);

MUCH better way of doing things.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] How to stop a query

2009-09-03 Thread A B
Hi.
How can I abort a query that I see is listed in

select * from pg_stat_activity;

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to stop a query

2009-09-03 Thread Guillaume Lelarge
Le vendredi 4 septembre 2009 à 07:37:20, A B a écrit :
 Hi.
 How can I abort a query that I see is listed in

 select * from pg_stat_activity;

You have to do:

  SELECT pg_cancel_backend(pid of the postgres process);


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] How to stop a query

2009-09-03 Thread Pavel Stehule
hello

2009/9/4 A B gentosa...@gmail.com:
 Hi.
 How can I abort a query that I see is listed in

 select * from pg_stat_activity;


look on pg_cancel_backend function

http://www.postgresql.org/docs/8.2/static/functions-admin.html

regards
Pavel Stehule

 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general