Re: [GENERAL] How to stop a query
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!=''; 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
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!=''; 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
Hi Scott, thank you for your comment 2012/7/19 Scott Marlowe > On Thu, Jul 19, 2012 at 3:17 AM, younus 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!=''; > > > > and > > > > SELECT pg_cancel_backend(procpid); > > MUCH better way of doing things. >